From: jumo at gmx dot de Operating system: debian PHP version: 5.1.2 PHP Bug Type: GD related Bug description: weird behaviour using imagecolorallocate very often
Description: ------------ I want to draw many squares on a PNG image, wich have changing color. after some correct drawed there is only one color used. Reproduce code: --------------- <?php $bigsize = 500; $colours = array( 'FF0000' , '00FF00' ); header("Content-type: image/png"); $im = imagecreate( $bigsize * 2 , 50 ); for( $j = 0; $j < $bigsize ; $j++ ) { $k = $j % count( $colours ); $r = hexdec( substr( $colours[ $k ] , 0 , 2 ) ); $g = hexdec( substr( $colours[ $k ] , 2 , 2 ) ); $b = hexdec( substr( $colours[ $k ] , 4 , 2 ) ); $fill = imagecolorallocate($im, $r , $g , $b ); imagefilledrectangle( $im , 2*$j , 0 , 2*$j+1 , 50 , $fill ); } imagepng($im); imagedestroy($im); ?> Expected result: ---------------- a bar with red and green vertical stripes wich have changing colors. Actual result: -------------- the right half of the bar is green. -- Edit bug report at http://bugs.php.net/?id=36218&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36218&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36218&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36218&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=36218&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=36218&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=36218&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=36218&r=needscript Try newer version: http://bugs.php.net/fix.php?id=36218&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=36218&r=support Expected behavior: http://bugs.php.net/fix.php?id=36218&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=36218&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=36218&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=36218&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36218&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=36218&r=dst IIS Stability: http://bugs.php.net/fix.php?id=36218&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=36218&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=36218&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=36218&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=36218&r=mysqlcfg