عن ابن عباس رضي الله عنهما ، قال: بينما النبي صلى الله عليه وسلم يخطب إذا هو برجل قائم فسأل عنه، فقالوا: أبو إسرائيل نذر أن يقوم في الشمس ولا يقعد، ولا يستظل؛ ولا يتكلم، ويصوم، فقال النبي صلى الله عليه وسلم : «مروه، فليتكلم، وليستظل، وليقعد، وليتم صومه».
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.
Download for free and never miss a prayer again