[Machine] The Messenger of Allah ﷺ said: "If one of you has doubts about his prayer, then if he doubts between one and two, let him take them as one. And if he doubts between two and three, let him take them as two. And if he doubts between three and four, let him take them as three, until the uncertainty lies in the extra (rak'ah). Then he should make two prostrations before he says the Salam." Muhammad ibn Ishaq said: "Husayn ibn Abdullah asked me, 'Did he narrate this to you?' I said, 'No.' He said, 'But he informed me that Kurayb, the freed slave of Ibn Abbas, narrated to him from Ibn Abbas, who said, 'I sat with Umar ibn al-Khattab and he said, 'O Ibn Abbas, if a person is confused in his prayer and does not know whether he has added or missed something, what should he do?' I said, 'By Allah, O Amir al-Mu'minin (Commander of the Faithful), I do not know anything about that.' Umar said, 'By Allah, I do not know either.' While we were discussing this, Abd al-Rahman ibn Awf came and said, 'What are you two talking about?' Umar said, 'We were discussing a man who has doubts about his prayer and what he should do.' Abd al-Rahman said, 'I heard the Messenger of Allah ﷺ say this.'"
أَنَّ رَسُولَ اللهِ ﷺ قَالَ إِذَا صَلَّى أَحَدُكُمْ فَشَكَّ فِي صَلاتِهِ فَإِنْ شَكَّ فِي الْوَاحِدَةِ وَالثِّنْتَيْنِ فَلْيَجْعَلْهُمَا وَاحِدَةً وَإِنْ شَكَّ فِي الثِّنْتَيْنِ وَالثَّلاثِ فَلْيَجْعَلْهُمَا ثِنْتَيْنِ وَإِنْ شَكَّ فِي الثَّلاثِ وَالْأَرْبَعِ فَلْيَجْعَلْهُمَا ثَلاثًا حَتَّى يَكُونَ الْوَهْمُ فِي الزِّيَادَةِ ثُمَّ يَسْجُدْ سَجْدَتَيْنِ قَبْلَ أَنْ يُسَلِّمَ ثُمَّ يُسَلِّمْ قَالَ مُحَمَّدُ بْنُ إِسْحَاقَ وَقَالَ لِي حُسَيْنُ بْنُ عَبْدِ اللهِ هَلِ أسْنَدَهُ لَكَ؟ فَقُلْتُ لَا فَقَالَ لَكِنَّهُ حَدَّثَنِي أَنَّ كُرَيْبًا مَوْلَى ابْنِ عَبَّاسٍ حَدَّثَهُ عَنِابْنِ عَبَّاسٍ قَالَ جَلَسْتُ إِلَى عُمَرَ بْنِ الْخَطَّابِ فَقَالَ يَا ابْنَ عَبَّاسٍ إِذَا اشْتَبَهَ عَلَى الرَّجُلِ فِي صَلاتِهِ فَلَمْ يَدْرِ أَزَادَ أَمْ نَقَصَ؟ قُلْتُ وَاللهِ يَا أَمِيرَ الْمُؤْمِنِينَ مَا أَدْرِي مَا سَمِعْتُ فِي ذَلِكَ شَيْئًا فَقَالَ عُمَرُ وَاللهِ مَا أَدْرِي قَالَ فَبَيْنَا نَحْنُ عَلَى ذَلِكَ إِذْ جَاءَ عَبْدُ الرَّحْمَنِ بْنُ عَوْفٍ فَقَالَ مَا هَذَا الَّذِي تَذَاكَرَانِ؟ فَقَالَ لَهُ عُمَرُ ذَكَرْنَا الرَّجُلَ يَشُكُّ فِي صَلاتِهِ كَيْفَ يَصْنَعُ فَقَالَ سَمِعْتُ رَسُولَ اللهِ ﷺ يَقُولُ هَذَا الْحَدِيثَ