The Messenger of Allah ﷺ said, "Whoever forgets a prayer should perform it as soon as he remembers it."
حدثنا قتيبة وبشر بن معاذ قالا حدثنا أبو عوانة عن قتادة
قال رسول الله ﷺ من نسي صلاة فليصلها إذا ذكرها
Agreed upon by Bukhari and Muslim. Muslim reported it, see the previous hadith, no. 684, from Qutayba, and Bukhari reported it in the Book of Prayer Times, chapter "Whoever forgets a prayer should pray it when he remembers it... etc," no. 597, from the hadith of Qatada, with the same chain.There is also a version on this subject from Samura [Ahmad: 22/5] and Abu Qatada [Muslim, no. 683].The hadith of Ali is the hadith of Abu Bakra.