حَدَّثَنَا مُسَدَّدٌ، قَالَ حَدَّثَنَا يَحْيَى، عَنْ عُبَيْدِ اللَّهِ، قَالَ حَدَّثَنِي نَافِعٌ، عَنِ ابْنِ عُمَرَ ـ رضى الله عنهما ـ أَنَّ النَّبِيَّ صلى الله عليه وسلم قَالَ فِي غَزْوَةِ خَيْبَرَ ‏"‏ مَنْ أَكَلَ مِنْ هَذِهِ الشَّجَرَةِ ـ يَعْنِي الثُّومَ ـ فَلاَ يَقْرَبَنَّ مَسْجِدَنَا ‏"‏‏.‏
Translation
Narrated `Abdul `Aziz

A man asked Anas, "What did you hear from the Prophet (ﷺ) about garlic?" He said, "The Prophet (ﷺ) said, 'Whoever has eaten this plant should neither come near us nor pray with us."