From: linuxtyh at gmail dot com Operating system: Windows xp PHP version: 5.2.0 PHP Bug Type: *Graphics related Bug description: NO IMG OUTPUT IF SOME ADDITIONAL SCRIPT BLOCK IS WRITTEN BEFORE THE IMG CODE
Description: ------------ IN MY CODE , there is an empty code block before the real useful code block , the empty code block cause no img output in my server Reproduce code: --------------- <?php ///THIS BLOCK OF CODE CAN CAUSE NO IMG OUTPUT // ÏÐÀ´ÎÞʱà´ËÒ»³Ì // created by linuxtyh // 08.12.2006 6:35:40 PM // ?> <?php error_reporting(0); $width=700; $height=700; $image = imagecreate($width, $height); $bg = imagecolorallocate($image, 200, 200, 200); $textcolor = imagecolorallocate($image, 0, 0, 255); $linecolor = imagecolorallocate($image, 20, 100, 200); if(!isset($_GET["function"])||$_GET["function"]=="") { imagestring($image, 5, 0, 0, "no function found.", $textcolor); //echo("no func"); } else { $function= $_GET["function"]; imagestring($image, 5, 0, 0, "function: y=$function ", $textcolor); //echo("found func"); $amp=30; //amplify if( isset($_GET["amplify"])) { $amp= $_GET["amplify"]; } $dx=0; //offset $dy=0; // $start=-$width/2; $end=$width/2; $function=str_replace ("x","((\$x)/$amp-$dx)" ,$function); $function="\$y=$height/2-$amp*($function+$dy);" ;//+";"; $x=$start; $y; try{ eval($function); }catch(Exception $error) { $y=1e20; } $oldx=$x;$oldy= $y ; imageline($image, 0 , $height/2, $width , $height/2 , $linecolor); imageline($image, $width /2 , 0, $width /2 , $height , $linecolor); $ox=$width /2;$oy=$height/2; for($i=0;$i<$width/2;$i+=1*$amp) { imageline($image, $width /2+$i , $height/2, $width /2+ $i , $height/2-2 , $linecolor); imagestring($image, 1, $width /2+$i , $height/2+2 , ""+$i/$amp , $textcolor ); imageline($image, $width /2-$i , $height/2, $width /2- $i , $height/2-2 , $linecolor); imagestring($image, 1, $width /2-$i , $height/2+2 , ""+(-$i)/$amp , $textcolor ); } for($i=$amp;$i<$height/2;$i+=1*$amp) { imageline($image, $width /2 , $height/2+$i, $width /2+ 2 , $height/2+$i , $linecolor); imagestring($image, 1,$width /2 +4 , $height/2+$i, ""+(-$i)/$amp , $textcolor ); imageline($image, $width /2 , $height/2-$i, $width /2+ 2 , $height/2-$i , $linecolor); imagestring($image, 1,$width /2 +4 , $height/2-$i, ""+($i)/$amp , $textcolor ); } for($x=$start; $x<=$end; $x++) { try{ eval($function); }catch(Exception $error) { $y=1e20; } imageline($image, $oldx+$width/2 , $oldy, $x+$width/2 , $y , $linecolor); $oldx=$x; $oldy=$y; } } header("Content-type: image/png"); imagepng($image); imagedestroy($image); ?> Expected result: ---------------- a math function image Actual result: -------------- no image output but an image of red cross -- Edit bug report at http://bugs.php.net/?id=39778&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39778&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39778&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39778&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=39778&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=39778&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=39778&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=39778&r=needscript Try newer version: http://bugs.php.net/fix.php?id=39778&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=39778&r=support Expected behavior: http://bugs.php.net/fix.php?id=39778&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=39778&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=39778&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=39778&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39778&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=39778&r=dst IIS Stability: http://bugs.php.net/fix.php?id=39778&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=39778&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=39778&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=39778&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=39778&r=mysqlcfg