Bug #64822 [Opn]: imagettftext not closing font file handle
| From: | amxmodx dot unloco at gmail dot com | Date: | Sun, 12 May 2013 12:46:47 +0000 |
| Subject: | Bug #64822 [Opn]: imagettftext not closing font file handle | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-178905@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=64822&edit=1
ID: 64822
User updated by: amxmodx dot unloco at gmail dot com
Reported by: amxmodx dot unloco at gmail dot com
Summary: imagettftext not closing font file handle
Status: Open
Type: Bug
Package: GD related
-Operating System: win8
+Operating System: win8 32bit
-PHP Version: 5.4.15
+PHP Version: 5.4.4
Block user comment: N
Private report: N
New Comment:
PHP v5.4.4
Previous Comments:
------------------------------------------------------------------------
[2013-05-12 12:39:05] amxmodx dot unloco at gmail dot com
Description:
------------
after using imagettftext the font file handle is not closed which makes it
impossible to rename/delete the font file without restarting Apache
$font = '../data/font/arruski.ttf';
$a = imagettftext($im, 20, 0, 10, 20, $white, $font, $text);
Using "Process Explorer" I was able to see that several font files are still open.
screenshot:http://i44.tinypic.com/2iubwu8.png
Test script:
---------------
header('Content-Type: image/png');
$im = imagecreatetruecolor(400, 30);
$white = imagecolorallocate($im, 255, 255, 255);
$text = 'Test';
$font = '../data/font/arruski.ttf';
$a = imagettftext($im, 20, 0, 10, 20, $white, $font, $text);
$fp = fopen($font,'r');
fclose($fp);
imagepng($im);
imagedestroy($im);
Expected result:
----------------
the font file would be released after script execution
Actual result:
--------------
the font file is not released.
"The action can't be completed because the file is open in httpd.exe"
Users cannot replace/rename/delete font file !
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64822&edit=1