This Companion made a vow not to talk, eat, or drink while he would stand in the sun without seeking shade. This is torture of the self and is quite hard on it. It is an unlawful vow; therefore, the Prophet (may Allah's peace and blessings be upon him) forbade him from doing so. Nevertheless, he ordered him to complete his fast because fasting is a permissible act of worship and thus he was obliged to fulfill his vow of fasting. Consequently, whoever makes a vow to do a permissible act of worship must fulfill it, whereas one is not obliged to fulfill their vow in case it involves an impermissible act of worship.