From: phpsupport at shopandlearn dot net
Operating system: Windows XP with SP2
PHP version: 5.0.2
PHP Bug Type: GD related
Bug description: GD imagegif temp files not removed
Description:
------------
After using the script included with this report, I find temp files in my
root directory with names in hexidecimal numbers. (examples: 137.tmp and
13A.tmp) I renamed one file from 137.tmp to 137.gif and it displayed as
the same image that the script created.
I found that if I remeove the line containing imagegif() from the script,
I do not get the unwanted temp files.
I also found that if I output as imagegif() or imagejpeg(), I don't get
the unwanted temp files.
This leads me to believe that the problem is in the imagegif() function.
My Computer is:
Windows XP with Service Pack 2
MB: Intel D850GB
Processor: Intel P4 1.6GHZ
RAM: 512 MB
Apache 2.0.52
PHP 5.0.2 with php_gd2.dll (5.0.2.2) & php_mysql.dll
Reproduce code:
---------------
<?php
# This function creates an image of a number
# Tested using PHP 5.0.2 and the included GD2 dll
header ("Content-type: image/gif");
$font = 3;
$number = $_REQUEST['no'];
$width = (strlen($number) * 8)+1; # Make counter only as wide as input
$im = @imagecreate($width, 16) # ($width, $height)
or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 0, 0, 0);
$text_color = imagecolorallocate($im, 255, 255, 255); # ($image, $r, $g,
$b)
$line_color = imagecolorallocate($im, 200, 200, 200); # ($image, $r, $g,
$b)
for ($x=8;$x<($width-5);$x+=7){ # draw vertical lines between numbers (for
counter reel effect)
imageline($im, $x, 0, $x, 20, $line_color);
}
imagestring($im, $font, 2, 1, $number, $text_color); # ($image,
$font, $x, $y, $color)
imagegif($im);
imagedestroy($im);
?>
Expected result:
----------------
I expect it to execute and show an image in the browser. I also expect the
script to delete any tempory files it creates.
Actual result:
--------------
The script does what is expected with the exception of leaving the
unwanted temp files.
--
Edit bug report at http://bugs.php.net/?id=30348&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30348&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30348&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30348&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=30348&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=30348&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=30348&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=30348&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=30348&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=30348&r=support
Expected behavior: http://bugs.php.net/fix.php?id=30348&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=30348&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=30348&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=30348&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30348&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=30348&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=30348&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=30348&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=30348&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=30348&r=mysqlcfg