CodeSOD: Code Changes Over Time
by Remy Porter from The Daily WTF on (#171GD)
Code changes over time. Most of what developers do is manage changes to code. Dana inherited some pretty awful PHP, and decided to take some time to improve performance and make sure any errors thrown by the PHP were actually displayed nicely for the user.
While looking at the file-upload module, Dana found this:
//$sze = 1024 * 1024 * 5; // 2Mb[...]$size = $_FILES['userfile']['size'];[...]//if ($_FILES['userfile']['size'] > $sze) {if ($_FILES['userfile']['size'] > $size) { return 'Error';}
This is code that's been changed. This is the sort of code that sits at the end of the bar, not making eye contact with anyone, and drinking shots of rotgut until it doesn't remember why it's there in the first place. There's a seedy story written in every line of this code block.
[Advertisement] Release!is a light card game about software and the people who make it. Play with 2-5 people, or up to 10 with two copies - only $9.95 shipped!