The Messenger of Allah ﷺ said, "If a man's ablution is broken after he has sat at the end of his prayer but before he gives the salam, his prayer is valid."
حدثنا أحمد بن محمد بن موسى الملقب مردويه قال أخبرنا ابن المبارك أخبرنا عبد الرحمن بن زياد بن أنعم أن عبد الرحمن بن رافع وبكر بن سوادة أخبراه
قال رسول الله ﷺ إذا أحدث يعني الرجل وقد جلس في آخر صلاته قبل أن يسلم فقد جازت صلاته
No references are available.
Isnad grading, its isnad is daif.Abu Dawud also recorded it, in the Book of Prayer, chapter titled "The Imam Who Breaks Wind After Raising His Head From the Last Rakat," hadith no. 617, from the hadith of Abdul-Rahman bin Ziyad Afriqi, and he is daif, as stated in Taqrib and other sources. Daraqutni said, 1/379, "Abdul-Rahman bin Ziyad is daif, not to be relied upon."