حَدَّثَنَا أَبُو خَيْثَمَةَ، حَدَّثَنَا يَعْقُوبُ بْنُ إِبْرَاهِيمَ، حَدَّثَنَا أَبِي، عَنِ ابْنِ إِسْحَاقَ قَالَ: حَدَّثَنِي مَكْحُولٌ، عَنْ كُرَيْبٍ، مَوْلَى ابْنِ عَبَّاسٍ، عَنْ عَبْدِ اللَّهِ بْنِ عَبَّاسٍ قَالَ: جَلَسْتُ مَعَ عُمَرَ بْنِ الْخَطَّابِ فَقَالَ لِي: يَا ابْنَ عَبَّاسٍ، هَلْ سَمِعْتَ عَنْ رَسُولِ اللَّهِ صلى الله عليه وسلم شَيْئًا أَمَرَ بِهِ الْمُسْلِمَ إِذَا سَهَا فِي صَلَاتِهِ، كَيْفَ يَصْنَعُ؟ قَالَ: فَقُلْتُ: لَا وَاللَّهِ، أَوَمَا سَمِعْتَ أَنْتَ يَا أَمِيرَ الْمُؤْمِنِينَ مِنْ رَسُولِ اللَّهِ صلى الله عليه وسلم فِي ذَلِكَ شَيْئًا؟ قَالَ: فَقَالَ: لَا وَاللَّهِ، فَبَيْنَمَا نَحْنُ فِي ذَلِكَ أَتَى عَبْدُ الرَّحْمَنِ بْنُ عَوْفٍ فَقَالَ: فِيمَ أَنْتُمَا؟ قَالَ: فَقَالَ لَهُ عُمَرُ: سَأَلْتُهُ، فَأَخْبَرَهُ عَمَّا سَأَلَهُ، فَقَالَ لَهُ عَبْدُ الرَّحْمَنِ: لَكِنِّي قَدْ سَمِعْتُ رَسُولَ اللَّهِ صلى الله عليه وسلم يَأْمُرُ فِي ذَلِكَ، فَقَالَ لَهُ عُمَرُ: فَأَنْتَ عِنْدَنَا عَدْلٌ، فَمَاذَا سَمِعْتَ مِنْ رَسُولِ اللَّهِ صلى الله عليه وسلم؟ قَالَ: فَقَالَ عَبْدُ الرَّحْمَنِ: سَمِعْتُ رَسُولَ اللَّهِ صلى الله عليه وسلم يَقُولُ: «إِذَا سَهَا أَحَدُكُمْ فِي صَلَاتِهِ حَتَّى لَا يَدْرِي أَزَادَ أَمْ نَقَصَ، فَإِنْ كَانَ شَكَّ فِي الْوَاحِدَةِ وَالثِّنْتَيْنِ فَلْيَجْعَلْهَا وَاحِدَةً، وَإِذَا شَكَّ فِي الثِّنْتَيْنِ أَوِ الثَّلَاثَةِ فَلْيَجْعَلْهَا ثِنْتَيْنِ، وَإِذَا شَكَّ فِي الثَّلَاثَةِ وَالْأَرْبَعِ فَلْيَجْعَلْهَا ثَلَاثًا حَتَّى يَكُونَ الْوَهْمُ فِي الزِّيَادَةِ، ثُمَّ يَسْجُدُ سَجْدَتَيْنِ وَهُوَ جَالِسٌ قَبْلَ أَنْ يُسَلِّمَ، ثُمَّ يُسَلِّمُ»
It is narrated from Sayyiduna Abdullah bin Abbas (may Allah be pleased with them both) that he said: I was sitting with Sayyiduna Umar bin al-Khattab (may Allah be pleased with him), and he said to me: "O Ibn Abbas, have you heard anything from the Messenger of Allah (peace and blessings be upon him) that he commanded a Muslim to do when he forgets in his prayer, what he should do?" I said: "No, by Allah. O Commander of the Believers, have you not heard anything from the Messenger of Allah (peace and blessings be upon him) about this?" He said: "No, by Allah." While we were in this conversation, Sayyiduna Abd al-Rahman bin Awf (may Allah be pleased with him) came and asked: "What are you two engaged in?" Sayyiduna Umar (may Allah be pleased with him) told him that he had asked him this question. Sayyiduna Abd al-Rahman (may Allah be pleased with him) said: "But I have heard the Messenger of Allah (peace and blessings be upon him) give a command about this." Sayyiduna Umar (may Allah be pleased with him) said: "You are trustworthy in our view, so what did you hear from the Messenger of Allah (peace and blessings be upon him)?" He said: I heard the Messenger of Allah (peace and blessings be upon him) say: "When one of you forgets in his prayer, so that he does not know whether he has prayed more or less, then if he is in doubt between one and two, let him count it as one; if he is in doubt between two and three, let him count it as two; and if he is in doubt between three and four, let him count it as three, so that the uncertainty is in the excess. Then let him perform two prostrations while sitting before giving the salam, and then give the salam."