Sayyiduna Abu Hurairah (may Allah be pleased with him) narrates that the Noble Prophet (peace and blessings be upon him) said: "Indeed, Satan comes to one of you while he is performing his prayer, and he confuses his prayer for him, until he does not know how many rak‘ahs he has prayed. So whoever faces such a situation should perform two prostrations while sitting." The meaning of the narration from Yahya bin Abi Kathir and Muhammad bin ‘Amr is also similar, that Sayyiduna Abu Hurairah (may Allah be pleased with him) narrates from the Noble Prophet (peace and blessings be upon him) that he said: "Until the state of the one praying becomes such that he does not know how many rak‘ahs he has prayed, whether three or four? So he should perform two prostrations while sitting (in tashahhud)."
And the command to perform the two prostrations of forgetfulness is mentioned in a brief report, not a detailed one. Many of those who cannot distinguish between what is explained and what is general, and do not understand the brief and the detailed reports, may think that the one who is doubtful in his prayer is allowed to end his prayer upon doubt after performing the two prostrations of forgetfulness.
Hadith Referenceصحيح ابن خزيمه / جماع أبواب السهو فى الصلاة / 1020
And the command to perform the two prostrations of forgetfulness is mentioned in a brief report, not a detailed one. Many of those who cannot distinguish between what is explained and what is general, and do not understand the brief and the detailed reports, may think that the one who is doubtful in his prayer is allowed to end his prayer upon doubt after performing the two prostrations of forgetfulness.
Sayyiduna Abu Hurairah (may Allah be pleased with him) narrates that the Noble Prophet (peace and blessings be upon him) said: "Indeed, Satan comes to one of you while he is performing his prayer, and he confuses his prayer for him, until he does not know how many rak‘ahs he has prayed. So whoever faces such a situation should perform two prostrations while sitting." The meaning of the narration from Yahya bin Abi Kathir and Muhammad bin ‘Amr is also similar, that Sayyiduna Abu Hurairah (may Allah be pleased with him) narrates from the Noble Prophet (peace and blessings be upon him) that he said: "Until the state of the one praying becomes such that he does not know how many rak‘ahs he has prayed, whether three or four? So he should perform two prostrations while sitting (in tashahhud)."
Hadith Referenceصحيح ابن خزيمه / جماع أبواب السهو فى الصلاة / 1020
Hadith Takhrijصحيح بخاري
Hadith 1021
Sayyiduna Abu Sa'id Khudri (may Allah be pleased with him) narrates from the Noble Prophet (peace and blessings of Allah be upon him) that he (peace be upon him) said: "When a person (the one praying) forgets and does not know how many units of prayer he has performed, then he should perform two prostrations while he is sitting (in Tashahhud)."
Hadith Referenceصحيح ابن خزيمه / جماع أبواب السهو فى الصلاة / 1021
In the narration from Sayyiduna Abdullah bin Ja'far and Sayyiduna Muawiyah (may Allah be pleased with them both) from the Prophet (peace and blessings be upon him), it is stated: "Whoever has doubt in his prayer should perform two prostrations while sitting in Tashahhud." (The author of the book states:) I have mentioned these ahadith with their chains of narration in Kitab al-Kabir. And these words are brief and not detailed.
Hadith Referenceصحيح ابن خزيمه / جماع أبواب السهو فى الصلاة / 1022