Abu Hurairah (RAA) narrated that The Messenger of Allah (ﷺ) said:
'Whoever forgets that he is fasting, and eats or drinks is to complete his fast, as it was Allah who fed him and gave him something to drink." Agreed upon.
English reference: Book 5, Hadith 690
Arabic reference: Book 5, Hadith 669