All perfect praise be to Allaah, the Lord of the worlds. I testify that there is none worthy of worship except Allaah and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and messenger.
If a Muslim consciously and willfully cursed the religion, then this act takes him out of the fold of Islam, we seek refuge with Allaah from this! That being said, whoever commits such a sin must immediately repent and profess the two testimonies of faith; i.e. saying, “Ash-hadu anllaa 'ilaaha illallaah, wa ash-hadu anna Muhammadan Rasool-ul-Allaah.” (i.e. I testify that none is truly worthy of worship except Allaah and that Muhammad is the Messenger of Allaah). Also, he should turn to Allaah in sincere repentance and frequently ask Him for forgiveness. Since his cursing of the religion happened during daytime in Ramadan, his fast is invalid and he is required to make up for that day.
Allaah Knows best.