Edit: this has been almost entirely rewritten as I've narrowed down the issue.
I'm using a Vagrant VM to mirror the client's environment as closely as I can. I'm using VirtualBox 4.3 (with Guest Additions 4.3) with Vagrant 1.3.5, and the server is running CentOS 5.9, Apache 2.2.3-83, PHP 5.3.3, and Drupal 7.
When the server first starts the original files in the shared directory, where my application resides, are cached. When I change the file the original file +/- the filesize delta is served, leading to the image corruption I saw before. So additions add NUL characters on the end of the original, and deletions truncate the file. When I view the file using
nano the contents are correct; restarting the
httpd service makes no difference. I have to restart the VM for the changes to be served correctly.
// The quick brown fox
// The quick brown fox jumps over the lazy dog
// The quick brown fox\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
Where exactly does this error lie? With Apache 2.2 or its dependencies, or with VirtualBox and its Guest Additions?