Abu Hurairah reported,

A man from among the people came to the Messenger of Allah ﷺ while he was in the mosque and called out to him, "Messenger of Allah, I have committed adultery," meaning himself.The Prophet ﷺ turned away from him. The man moved to the side of his face from which he had turned away and said, "Messenger of Allah, I have committed adultery."The Prophet turned away from him again. The man came around to the other side of the Prophet's face from which he had turned, and repeated his confession.When he had testified against himself four times, the Prophet ﷺ called him over and asked, "Are you mad?"He replied, "No, Messenger of Allah."The Prophet asked, "Are you married?"He answered, "Yes, Messenger of Allah."The Prophet said, "Take him away and stone him."

Bukhari 6825

Sahih

حدثنا سعيد بن عفير قال حدثني الليث حدثني عبد الرحمن بن خالد عن ابن شهاب عن ابن المسيب وأبي سلمة أن

أبا هريرة قال

أتى رسول الله ﷺ رجل من الناس وهو في المسجد فناداه يا رسول الله إني زنيت يريد نفسه فأعرض عنه النبي ﷺ فتنحى لشق وجهه الذي أعرض قبله فقال يا رسول الله إني زنيت فأعرض عنه فجاء لشق وجه النبي ﷺ الذي أعرض عنه فلما شهد على نفسه أربع شهادات دعاه النبي ﷺ فقال أبك جنون قال لا يا رسول الله فقال أحصنت قال نعم يا رسول الله قال اذهبوا به فارجموه

البخاري 6825صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Legal punishments
Chapter
Asking the confessor if he was married
Numbering
Darussalam 6825
Bukhari 6825