The Prophet ﷺ said, "If someone forgets and eats or drinks, let him complete his fast, for it was only Allah who fed him and gave him drink."
عن النبي ﷺ قال: إذا نسي فأكل وشرب فليتم صومه؛ فإنما أطعمه الله وسقاه.
Bukhari related it in the Book of Fasting (1933), and Muslim in the Book of Fasting (1155), both of them by way of Hisham bin Hassan Qurdusi, who said, "Muhammad bin Sirin narrated to us, from Abu Hurairah," and he related it. Their wording is the same.