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] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!