When Rus sent in his résumé for a systems administrator position, he made the mistake of including "PHP" as a bullet point. It's not that he doesn't know PHP - it's that he does, and is often stuck with trying to debug problems that the PHP developers blame on "the system."

Recently, he was tasked with diagnosing a problem where files uploaded to the site ending up at zero bytes in size. It had been thwarting the PHP developer for nearly three weeks. Due to the distributed nature of the site, uploading a file involved posting the file to one page, programmatically urlencoding the file, and then posting to a different page. Not trusting that it was a problem with "the system," Rus looked at the previous working code in the commit history ...

$contents = file_get_contents($filename);
$contents = urlencode($contents);

After that point, libcurl is prepped to post $contents. In the latest version, however, those two lines were changed to ...

foreach (file($filename) as $line) 
  $contents.= $line;


After which point, libcurl is prepped to post $contents. The commit message was "prevent writing uploaded file to string from running out of memory."

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!