Rachel worked on a system which collected data about children, provided by parents and medical professionals. There was one bug that drew a lot of fire: no one could report the age of a child as less than one. That was a problem, as for most of their users, child ages are zero-indexed. One of the devs picked up the bug, made a change, and went on to the next bug.

This was the fix:

if (!empty($_POST["age_at_time"]) || empty($_POST["age_at_time"]))

The original check had been !empty- which may seem like it's ensuring a value was provided, but in PHP the empty function returns true for null values, empty strings, and anything falsey- like the integer 0.

So they made a change to cover the other case, and never stopped to ask themselves, "Would doing this be stupid?"

[Advertisement] Plan Your .NET 9 Migration with Confidence
Your journey to .NET 9 is more than just one decision.Avoid migration migraines with the advice in this free guide. Download Free Guide Now!