331 صحيح حديث ابْنِ عُمَرَ، أَنَّ النَّبِيَّ صَلَّى اللهُ عَلَيْهِ وَسَلَّمَ قَالَ فِي غَزْوَةِ خَيْبَرَ: مَنْ أَكَلَ مِنْ هذِهِ الشَّجَرَةِ يَعْنِي الثُّومَ فَلاَ يَقْرَبَنَّ مَسْجِدَنَا
Sayyiduna Ibn Umar (may Allah be pleased with them both) narrated that the Noble Prophet (peace and blessings be upon him) said at the time of the Battle of Khaybar that whoever has eaten from this tree, meaning garlic, should not come to our mosque.
Brief Explanation
Raw garlic or raw onion is meant, as eating these causes an odor in the mouth. It is also obligatory for smokers that they clean their mouths, remove the odor, and thoroughly rub their mouths with a miswak before coming to the mosque. All such foul-smelling things have the same ruling. The only difference is that garlic and onion can be made suitable for use by cooking them. (Raaz)