Both of my ears heard the Messenger of Allah saying this: He who claimed the fatherhood of anyone else besides his real father knowingly (committed a great sin) ;Paradise is forbidden to him. Abu Bakra asserted that he too heard it from the Messenger of Allah (may peace be upon him ). (Using translation from Muslim 63a)
لَمَّا ادُّعِيَ زِيَادٌ لَقِيتُ أَبَا بَكْرَةَ قَالَ فَقُلْتُ مَا هَذَا الَّذِي صَنَعْتُمْ؟ إِنِّي سَمِعْتُ سَعْدَ بْنَ أَبِي وَقَّاصٍ يَقُولُ سَمِعَ أُذُنِي مِنْ رَسُولِ اللهِ ﷺ وَهُوَ يَقُولُ مَنِ ادَّعَى أَبًا فِي الْإِسْلامِ غَيْرَ أَبِيهِ وَهُوَ يَعْلَمُ أَنَّهُ غَيْرُ أَبِيهِ فَالْجَنَّةُ عَلَيْهِ حَرَامٌ فَقَالَ أَبُو بَكْرَةَ وَأَنَا سَمِعْتُهُ مِنْ رَسُولِ اللهِ ﷺ