ID: 36413 User updated by: smartbitcalc at hotmail dot com Reported By: smartbitcalc at hotmail dot com Status: Bogus Bug Type: GD related Operating System: Win32 (98SE, XPH/SP1) PHP Version: 5CVS-2006-02-16 (snap) New Comment:
What a quick reply! Thanks, Derick. However -- The ability to output an image directly to the browser is exclusive to PHP's implementation of GD. Wouldn't it be a good idea to, say, update either the documentation or the library so that people don't keep reporting the same "bogus" issue? Previous Comments: ------------------------------------------------------------------------ [2006-02-16 11:16:40] [EMAIL PROTECTED] Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. Of course it does this... you're outputting extra space, why should PHP not do this? This is not a bug. ------------------------------------------------------------------------ [2006-02-16 11:11:17] smartbitcalc at hotmail dot com Description: ------------ Win32 GD imagepng() outputs bad data to the browser when the source or any included file has extraneous whitespace surrounding the <?php ?> tags. Tested Systems: Windows 98 SE PHP 5CVS2006-Feb-15(snap), PHP 5.1.2, PHP 4.3.4RC1 MSIE 5.0, Firefox 1.0.6 Windows XP Home SP1 PHP 4.3.11, MSIE 6.0 (breaks on space|crlf before <?php, space+crlf after ?>) Reproduce code: --------------- test.php: <?php // include("testinc.php"); $text = "Happy Happy Joy Joy"; $test = ImageCreate(160,24); ImageFill($test,0,0,ImageColorAllocate($test,0,0,0)); ImageString($test,4,4,4,$text,ImageColorAllocate($test,255,255,255)); header("Content-type: image/png"); imagepng($test); ?> testinc.php: <?php $gettysburg = "Four score and seven years ago..."; ?>_ <-- note: insert whitespace (0x20) after closing tag Expected result: ---------------- Run test.php as listed and the browser displays the image as expected. Uncomment the include file, save and run test.php again, and the browser displays a "broken picture" icon. If you remove the trailing space from testinc.php the browser displays the image, but if you insert a space or a carriage return before the opening tag of either file, the image is "broken" again. (Firefox gives you the message 'The image "http://localhost/test.php" cannot be displayed, because it contains errors' rather than a broken image icon, but the cause and effect are the same.) Actual result: -------------- Speculation: the problem is actually intermittent (or appears to be) but at least this is verifiable. I have a hunch that the extraneous whitespace is somehow finding its way to the output buffer as the source is being parsed. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36413&edit=1
