'A'isha (Allah be pleased with her) reported
Sa'd b. Abu Waqqas and Abd b. Zam'a (Allah be pleased with them) disputed with each other over a young boy. Sa'd said: Messenger of Allah, he is the son of my brother 'Utba b. Abu Waqqas as he made it explicit that he was his son. Look at his resemblance. Abd b. Zam'a said Messenger of Allah, he is my brother as he was born on the bed of my father from his slave-girl. Allah's Messenger (ﷺ) looked at his resemblance and found a clear resemblance with 'Utba. (But) he said: "He is yours O 'Abd (b. Zam'a), for the child is to be attributed to one on whose bed it is born, and stoning for a fornicator. Sauda bint Zam'a, O you should observe veil from him." So he did not see Sauda at all. Muhammad b. Rumh did not make a mention (of the words): "O Abd."
A hadith like this is narrated on the authority of Ibn 'Uyaiyna and Ma'mar (and the words are)
The child is attributed to him on whose bed he is born; but they did not mention this:" For a fornicator there is stoning."
Abu Huraira (Allah be pleased with him) reported Allah's Messenger (ﷺ) as saying
The child is to be attributed to one on whose bed he is born, and for a fornicator there is stoning.
A hadith like this is narrated on the authority of Abu Huraira.