Sayyiduna Abu Hurayrah (may Allah be pleased with him) narrated that the Prophet (peace and blessings be upon him) said: "Whoever swears an oath, he becomes as he said: if he said, 'I am a Jew,' then he is a Jew; if he said, 'I am a Christian,' then he is a Christian; and if he said, 'I am a Magian,' then he is a Magian."
Abu Ya'la recorded it; its chain contains Ubays bin Maymun, who is matruk (abandoned).