The Shaykh (Al-Mufid), may Allah سبحانه وتعالى have mercy on him, said: “And one who completes (the prayer as four rak’ahs) while traveling, out of forgetfulness, must repeat the prayer if the time still remains; but if the time has passed, then there is no repetition upon him. However, whoever deliberately performs the prayer in full while traveling, after the proof for shortening has been established for him, his prayer is not valid and he must repeat it.”
Commentary #15