I slept with my food one night in 600 miles, when I was stealth camping miles away from the nearest shelter or hardened tentsite, and it was pouring out. Nothing bad happened.
Another night, in the Smokies. I was tenting in the area of a full shelter and I was woken to yelling at 1 or 2 in the morning, then I went back to sleep. A bear went right into the shelter with 15 people sleeping. It tore open two hanging packs with near surgical precision. It got a candy bar wrapper from one pack, and the peppermint soap from another. Someone got a picture of the bear walking within two feet of my tent after I'd fallen back asleep. (Blurry/grainy from the lack of light, I didn't even bother requesting a copy of the pic.) I might have had a bad night had I chosen to have food in my tent on that specific night. A few hikers were previously complaining that the Ridge Runner was being overly militant about telling people not to bring food into the shelter... no doubt they apologized to him in the morning.
So, be aware of your surroundings and and decide when/where you'll risk food in your tent.