Mishkat al-Masabih

‘Umar said: The Prophet (ﷺ) saw me standing and passing water and said, "‘Umar, do not pass water standing." So I never did it again. Tirmidhi and Ibn Majah transmitted it. The shaikh and imam Muhyi as-Sunna has given a sound tradition from Hudhaifa who said that the Prophet (ﷺ) came to a midden and passed water standing. (Bukhari and Muslim.) It is said that that had a valid reason.

وَعَن عمر قَالَ: رَآنِي النَّبِيُّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ وَأَنَا أَبُولُ قَائِمًا فَقَالَ: «يَا عُمَرُ لَا تَبُلْ قَائِمًا» فَمَا بُلْتُ قَائِمًا بَعْدُ. رَوَاهُ التِّرْمِذِيُّ وَابْنُ مَاجَهْ قَالَ الشَّيْخُ الْإِمَامُ مُحْيِي السّنة : قد صَحَّ: عَنْ حُذَيْفَةَ قَالَ: أَتَى النَّبِيُّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ سباطة قوم فَبَال قَائِما. . قيل: كَانَ ذَلِك لعذر