حَدَّثَنَا عَبَّاسُ بْنُ عَبْدِ الْعَظِيمِ، حَدَّثَنَا أَبُو عَامِرٍ عَبْدُ الْمَلِكِ بْنُ عَمْرٍو، حَدَّثَنَا خَالِدُ بْنُ مَيْسَرَةَ، - يَعْنِي الْعَطَّارَ - عَنْ مُعَاوِيَةَ بْنِ قُرَّةَ، عَنْ أَبِيهِ، أَنَّ النَّبِيَّ صلى الله عليه وسلم نَهَى عَنْ هَاتَيْنِ الشَّجَرَتَيْنِ وَقَالَ " مَنْ أَكَلَهُمَا فَلاَ يَقْرَبَنَّ مَسْجِدَنَا " . وَقَالَ " إِنْ كُنْتُمْ لاَ بُدَّ آكِلِيهِمَا فَأَمِيتُوهُمَا طَبْخًا " . قَالَ يَعْنِي الْبَصَلَ وَالثُّومَ .
Narrated Mu'awiyah ibn Qurrah: The Messenger of Allah (ﷺ) forbade these two plants (i.e. garlic and onions), and he said: He who eats them should not come near our mosque. If it is necessary to eat them, make them dead by cooking, that is, onions and garlic
Grade (as given by the source): Al-Albani: Sahih Muhammad Muhyi Al-Din Abdul Hamid: Sahih Shuaib Al Arnaut: Sahih Lighairihi Zubair Ali Zai: Isnaad Hasan