However, according to the established school, the prayer is not invalidated by resolving to do something that invalidates it unless he actually does it (1), because invalidation is contingent upon doing that invalidating act, and it has not occurred. This is the correct view.
Likewise, if a fasting person resolves to eat but does not eat, while not intending to end his fast, his fast is not invalidated.
Issue: Are all acts of worship invalidated by resolving to discontinue them?
The answer is: Yes, except for Hajj and ‘Umrah. Hajj and ‘Umrah are not invalidated by one’s intending to invalidate them. Even if he explicitly says, “I have discontinued my rites,” they are not discontinued, even if they are voluntary. Rather, he must continue with them, and they remain valid. This is one of the unique features of Hajj and ‘Umrah: they are not invalidated by ending the intention, due to the saying of Allah, “And complete the Hajj and ‘Umrah for Allah.” [al-Baqarah 2:196]
If he makes discontinuing the prayer conditional upon something, saying, “If Zayd speaks to me, I will end my intention,” or, “I will invalidate my prayer,” then, according to the jurists, it is invalidated (2). The correct view, however, is that it is not invalidated, for he may resolve that if Zayd speaks to him, he will speak, but then retract that resolve.
Thus, we now have four cases: a definite decision to discontinue; a decision to discontinue contingent upon a condition; hesitation about discontinuing; and resolving to commit a prohibited act.
As for the first: if he definitely ends the intention, then there is no doubt that the prayer is invalidated.