Hi,
This bug appears when reading a PDF with readImage() in imagick-php. Most
errors are thrown as an ImagickException. However, when an out-of-range page is
requested from a PDF, output is also sent directly to standard output, in
addition to the exception. Unlike normal output, it is impossible to suppress
this extra text with the normal tools (catch, @readImage, ob_start(), see
also[1]).
Example ('doc.pdf' contains two blank pages- any short file will work):
<?php
$im = new Imagick();
try {
$im -> readImage("doc.pdf[5]");
$im -> destroy();
} catch(ImagickException $e) {
echo "Error: " . $e -> getMessage() . "\n";
}
?>
Which prints:
Requested FirstPage is greater than the number of pages in the file: 2
No pages will be processed (FirstPage > LastPage).
Error: Failed to read the file
The extra output (aside from being incorrect) should be triggered as a
notice/warning, or included with the exception. The text appears to be
generated by GhostScript.
See attached test and example doc.