From:             smartbitcalc at hotmail dot com
Operating system: Win32 (98SE, XPH/SP1)
PHP version:      5CVS-2006-02-16 (snap)
PHP Bug Type:     GD related
Bug description:  Win32 GD imagepng(): bad output to browser failure

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 bug report at http://bugs.php.net/?id=36413&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=36413&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): 
http://bugs.php.net/fix.php?id=36413&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=36413&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=36413&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=36413&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=36413&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=36413&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=36413&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=36413&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=36413&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=36413&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=36413&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=36413&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=36413&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=36413&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=36413&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=36413&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=36413&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=36413&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=36413&r=mysqlcfg

Reply via email to