Hacham Ovadia writes in Halichot Olam (vol. 7, p. 209) that one should not store food or beverages underneath a bed while somebody sleeps on it. If a food or beverage was beneath a bed when somebody slept on it, then, according to some Poskim, the product may not be consumed. Most Poskim, however, allow partaking of the food or beverage after the fact, particularly if it was on a tiled or paneled floor, and not directly on the ground. Nowadays, then, as our floors are covered with panels or tiling, although one should not place food underneath a bed, food does not become forbidden if it was placed there.
If a person slept with food in his pocket, it remains permissible. Hacham Ovadia Yosef cites this ruling in the name of the kabbalist Rav Efrayim Ha'kohen (Baghdad-Jerusalem, 1885-1956), who testified that this was the position of the Ben Ish Hai (Rav Yosef Haim of Baghdad, 1833-1909).
If food was stored in the baggage compartment of a bus or plane, then even though people slept on top of the food, it remains permissible.

