The United States Food and Drug Administration issued a warning in 1993 about storing garlic in oil, triggering widespread concerns about the safety of keeping garlic in different types of fats. It is in fact perfectly safe to store garlic in oil, with a couple of critical caveats that should be kept in mind. Very few people have actually gotten sick from this garlic; the food-paranoid might want to be more worried about meat products like oysters and chicken, which routinely cause food-borne illness when handled improperly.
The concern with storing garlic in oil is that garlic is a low-acid vegetable, which makes it ideal for culturing Clostridium botulinum, the bacteria that causes botulism. As long as the bacterium is exposed to oxygen, it cannot develop the spores which secrete the toxin, so garlic itself is perfectly safe. However, when garlic is placed in oil or fat, an anaerobic environment is created, and if the bacteria is present, it can cause botulism in anyone who consumes the product.
Contaminated garlic in oil tastes, smells, and looks just like a product which is perfectly safe, which makes it even more dangerous. People could potentially consume the product, develop botulism, and die or become seriously ill. For this reason, the FDA advised consumers to generally avoid garlic oil, reducing the risk to zero.
However, garlic in oil can be safe. Commercial preparations have agents added to increase the acidity, killing off any bacteria which may be present, so this form is perfectly safe. Garlic-flavored olive and other cooking oils are also usually treated so that they are slightly acidic before packaging and sale, so that they will be safe for consumers. Freshly prepared oil, used immediately, is also safe, as the bacteria have no time to grow. Fresh products can also be refrigerated and used safely for up to one week. Home cooks lack the facilities necessary to add enough acid for long-term storage.
For people who prefer to err on the side of caution, avoiding garlic in oil is certainly an option. Others may prefer to seek out safe products, such as acidic commercial preparations or freshly-prepared homemade versions. Garlic in oil should not be used if it has been sitting at room temperature for more than a few hours, or if it has been refrigerated for over a week. As a reminder, it might be helpful to put a sticker on a refrigerated container with the date it was made, so that it can be thrown out when it is past the point of safe consumption.