Al-Ilmam bi-Ahadith al-Ahkam 536
وَعنهُ، قَالَ: قَالَ رَسُول الله ﷺ : " من نسي وَهُوَ صَائِم فَأكل أَو شرب فليتم صَوْمه، فَإِنَّمَا أطْعمهُ الله وسقاه ". لفظ مُسلم، وَهُوَ مُتَّفق عَلَيْهِ. وَعند الْحَاكِم: " من أكل فِي رَمَضَان نَاسِيا فَلَا قَضَاء عَلَيْهِ وَلَا كَفَّارَة "، وَقَالَ: صَحِيح عَلَى شَرط مُسلم، وَلم يخرجَاهُ.
And from him, who said: The Messenger of Allah ﷺ said: "Whoever forgets while fasting and eats or drinks, let him complete his fast, for it is only Allah who fed him and gave him drink." The wording is Muslim's, and it is agreed upon. And with al-Hakim: "Whoever eats in Ramadan out of forgetfulness has no making up and no expiation to do." And he said: Sound according to the condition of Muslim, and they did not record it.