Sayyiduna al-Mughirah bin Shu'bah (may Allah be pleased with him) says: I ate garlic in the time of the Prophet (peace and blessings be upon him), then I came to the mosque when one rak'ah of the prayer had already been completed. I joined the prayer, and the Prophet (peace and blessings be upon him) noticed its smell, so he (peace and blessings be upon him) said: "Whoever eats of this foul plant, let him not come near our place of prayer until its smell has gone." I completed my prayer, and when I had given the salam I said: O Messenger of Allah, I adjure you to give me your hand. So he (peace and blessings be upon him) gave me his hand, and I put it into the sleeve of my shirt and brought it to my chest. He (peace and blessings be upon him) found it bandaged there, and said: "You have an excuse," or: "I see that you have an excuse."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 5061