It's no fairy tale: Four hungry white dwarfs have been found "snacking" on the shattered remains of Earthlike planets, according to a new study.

The findings foreshadow what might happen to our solar system when the sun dies in about five billion years, astronomers say.

As stars like our sun run out of nuclear fuel, they swell, becoming red giants. Astronomers think that when this happens to our star, its bulging atmosphere will engulf Mercury, Venus, and maybe even Earth.

Eventually, the outer layers of a sunlike star's atmosphere will balloon away to form a nebula, leaving the star's dense core—a white dwarf—shining in the center. (See a white dwarf picture.)

The study authors speculate that any planets not roasted by the star's initial expansion—which takes tens to a few hundred million years—would have their orbits destabilized as the dying star loses mass.

The changing orbits would sometimes lead to planets crashing into each other, churning up chunks of rocky debris.

Eventually some of these planetary pieces could be nudged so close to the white dwarf that they'd fall into the star and get ripped apart.

Evidence for this theory seems to lie in the newly observed white dwarfs' atmospheres, said study leader Boris Gänsicke, an astrophysicist at the University of Warwick in the U.K.

Normally, a white dwarf's atmosphere is a mix of only hydrogen and helium, relatively light elements. That's because a white dwarf's intense gravity pulls heavier elements toward the star's core.

Any other chemicals in a white dwarf's atmosphere must therefore come from debris falling onto the star's surface.

To hunt for signs of planetary consumption, Gänsicke and colleagues looked at 80 white dwarf stars in ultraviolet using the NASA/ESA Hubble Space Telescope.

The team found four stars whose atmospheres contain oxygen, magnesium, iron, silicon, and a small bit of carbon—just the elements expected if the stars are absorbing dust from former planets.

"The abundances we find are almost exactly the same as those of the entire Earth," Gänsicke said. "If you could shred the Earth into dust and put it into the white dwarf, it would match the chemical composition."

In addition, one star, called PG0843+516, is even more heavily iron-enriched than the other dwarfs and contains high abundances of nickel and sulfur.