He tasted the food and swallowed it by mistake
Praise be to Allaah, and blessings and peace be upon the Messenger of Allaah.
There is nothing wrong with a fasting person tasting the food if he needs to, if he does that by testing it with the tip of his tongue, then he spits it out without swallowing anything, whether the one who is fasting is a man or a woman.
But if the fasting person forgets and swallows it by mistake, there is no sin on him, and he should complete his fast. This is because of the general meaning of the evidence which indicates that according to sharee’ah, the person who forgets is excused. The Prophet (peace and blessings of Allaah be upon him) said: “Whoever forgets that he is fasting and eats or drinks something, let him complete his fast, for it is Allaah Who has fed him and given him to drink.” (Agreed upon. Al-Bukhaari, 1399; Muslim 1155).
And Allaah knows best.