A PHP Error was encountered

Severity: 8192

Message: Return type of CI_Session_files_driver::open($save_path, $name) should either be compatible with SessionHandlerInterface::open(string $path, string $name): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Filename: drivers/Session_files_driver.php

Line Number: 132

A PHP Error was encountered

Severity: 8192

Message: Return type of CI_Session_files_driver::close() should either be compatible with SessionHandlerInterface::close(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Filename: drivers/Session_files_driver.php

Line Number: 290

A PHP Error was encountered

Severity: 8192

Message: Return type of CI_Session_files_driver::read($session_id) should either be compatible with SessionHandlerInterface::read(string $id): string|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Filename: drivers/Session_files_driver.php

Line Number: 164

A PHP Error was encountered

Severity: 8192

Message: Return type of CI_Session_files_driver::write($session_id, $session_data) should either be compatible with SessionHandlerInterface::write(string $id, string $data): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Filename: drivers/Session_files_driver.php

Line Number: 233

A PHP Error was encountered

Severity: 8192

Message: Return type of CI_Session_files_driver::destroy($session_id) should either be compatible with SessionHandlerInterface::destroy(string $id): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Filename: drivers/Session_files_driver.php

Line Number: 313

A PHP Error was encountered

Severity: 8192

Message: Return type of CI_Session_files_driver::gc($maxlifetime) should either be compatible with SessionHandlerInterface::gc(int $max_lifetime): int|false, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

Filename: drivers/Session_files_driver.php

Line Number: 354

News Swiftly

Got a Fruit Fly Problem? This Insect Expert's Advice Might Help

You spot a tiny bug hovering in your kitchen, and next thing you know, there are dozens or even hundreds of them.

Fruit flies are some of the most annoying pests to get rid of, especially once they've locked on to a food source in your home. And unfortunately, your living space is probably full of tasty treats, from fruits and veggies to sugary snacks.

CNET

With fruit flies, an ounce of prevention is worth a pound of cure. We asked Jody Green, an entomologist at the University of Nebraska-Lincoln, what causes fruit fly infestations and, more importantly, how to stop them or get rid of them once they start.

What causes fruit flies?

Beer, wine and soda are like a siren song for fruit flies. Katie Teague/CNET

Fruit flies will normally hitch onto any overripe fruit that you bring home from the grocery store, or any bruised fruit, which tends to ripen and rot more quickly.

Once the flies get in your house, she said, they'll lay eggs everywhere they can -- in rotten fruit or any fermented substances, especially onions and potatoes. And as it gets warmer, their life cycles quicken. That's how infestations happen.

Read more: Keep Bugs Out of Your Kitchen With These Common Houseplants

Thankfully, there are ways to kick fruit flies out of your kitchen and expel them from your home. Some steps can help prevent an infestation, while others can help eliminate one. So take a look below, and keep your place free of fruit flies.

What do fruit flies look like?

Once fruit flies descend on your kitchen, it's tough to get them to leave. David Watsky/CNET

Fruit flies are about an eighth of an inch long, have red eyes (though some species have darker eyes) and are light brown with dark rings around their abdomen. They also have two wings (many insects have four).

What sorts of foods and environments attract fruit flies?

Ripe produce and sugary foods are magnets for fruit flies. Helin Loik-Tomson/Getty Images

The common name that entomologists give fruit flies is "vinegar flies." That's because they're naturally attracted to fermented liquid, and when fruit rots, it also ferments.

But fruit flies don't thrive only on rotten fruit or vinegar. They also love sugary substances like soda, wine and beer, and you can find them in the bottom of your trash bin or any wet place with a substantial food source.

"Substantial food source" may mean something different to you than to the small but mighty fruit fly, Green said. "It may not be the food you are wanting to eat, but fruit flies are so tiny it only takes a tiny microhabitat" -- like the residual soda in a can in your recycling bin or leftover bits and crumbs in a takeout container in your garbage, Green explained. Those are prime spots for fruit flies to breed. Once the weather warms, it takes less time for fruit fly eggs to turn into babies.

How to stop stop a fruit fly infestation before it starts

Take the garbage out as often as possible during warm summer months. Taylor Martin/CNET

To prevent fruit flies from taking over your kitchen, it all comes down to cleaning. Keeping your place as dry and free of food as possible prevents pests from continuing their life cycle.

Throw away garbage and take out recycling frequently. Clean out the bottom of bins when liquid accumulates, wipe down counters after you're finished cooking, and keep your sink and garbage disposal free of old food, empty of dishes, and as dry as possible.

Storing fruits and vegetables in the fridge instead of on the counter will also make it harder for the fruit flies to find them. And since they're attracted to rotting fruit, you should carefully pick your produce at the store to make sure you aren't bringing any rotten or bruised pieces home, Green said.

She also added that you should recycle or compost cardboard boxes that hold produce as soon as possible, because fruit flies could be breeding in them. Any place that catches water or is moist, like a wet kitchen rag or the rug next to the sink, could become a breeding ground for fruit flies.

For more home tips, here are the best air purifiers for clean air and the best cordless vacuums.

FAQs

Can I get fruit flies without leaving out fruit? Yes, you can get fruit flies even if you don't leave fruits and vegetables outside of the fridge. Though fruit flies are attracted to fermented fruits and vegetables, they also love sugary substances. The flies will similarly swarm wine, beer, soda and other sugary liquids if you leave cups of them around the house.