CodeSOD: The Helpful Customer
Sven built a PHP-based website on contract then handed it off to his customer, Bob.
"You won't be getting a lot of support calls from me," Bob said, "because I actually know a thing or two about PHP. I'll be maintaining this myself."
Sven smiled, nodded, and moved on to the next contract. Months later, Bob sent him an email. "Hey, sometimes, the submit button isn't available, and I'd like the submit button to appear all the time, but I can't figure it out."
Sven was busy, didn't reply right away, and wasn't terribly surprised when his customer pinged him back: "Nevermind, I got it."
Eventually, though, Bob did find a problem he wasn't confident enough to solve himself. When Sven had handed it off, the logic to show the submit button looked like this:
<?php if($can_submit) : ?> <button>Submit</button><?php endif; ?>
Bob's revisions to make it so that the submit button always appeared?
<?php if(!isset($a3)) : ?> <button>Submit</button><?php ; ?><?php else : ?> <button>Submit</button><?php endif; ?>[Advertisement] Use NuGet or npm? Check out ProGet, the easy-to-use package repository that lets you host and manage your own personal or enterprise-wide NuGet feeds and npm repositories. It's got an impressively-featured free edition, too!