When you attempt to place a candle on a cake while hungry, the player will eat a slice of cake and will regenerate a bar of hunger, but on the very next tick the cake's slice will regenerate leaving the player with the extra bar of hunger. Then, if the player's food bar is updated through taking damage or eating another piece of food, the extra bar gained from the cake will disappear.
Note: This glitch does not lead to an infinite source of food.
To Recreate:
1. Attempt to place candle on cake while hungry.
2. Take damage or eat food.
Linked issues
Attachments
Comments

Thank you for your report!
We're tracking this issue in MC-204058, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
Can confirm