I have a picture class which makes use of Imagick. After a patch to a newer Imagick version as well as PHP 5.3, I noticed that a piece of code stopped working.
I had a member function called getFileHandle() whose purpose was to return a file handle. The reason for wrapping this in a function was due to the fact that I couldn't use ftp wrappers for image resources with Imagick. So for new uploads this function just used fopen(), and for previously uploaded files it would download from ftp, store in a temp file and fopen() that.
But suddenly my code breaks, and in the end I just take the contents of this function, and copy paste it into where it was called. So instead of
$f = $this->getFileHandle();
$imagick->readImageFile($f);
I now have the full code in place where it's used, along the lines of
if (isFtpFile) {
$this->createTmpFile(); // local copy
$f = fopen(tmpFile);
}
else
$f = fopen($this->filename);
$imagick->readImageFile($f);
Why do I get different results? i.e. the first approach used to work, and now it doesn't. And now, just reducing the abstraction level by removing a function call and placing the code directly where used, it works.