The Messenger of Allah ﷺ said, "I am only a human being. I forget just as you forget. So whichever of you has a doubt about his prayer, let him consider what is closest to being correct, complete his prayer based on that, and then perform two prostrations."
حدثنا محمد بن عبيد حدثنا مسعر عن منصور عن إبراهيم عن علقمة
قال رسول الله ﷺ إنما أنا بشر أنسى كما تنسون فأيكم ما شك في صلاته فلينظر أحرى ذلك الصواب فليتم عليه ويسجد سجدتين