From:             amxmodx dot unloco at gmail dot com
Operating system: win8
PHP version:      5.4.15
Package:          GD related
Bug Type:         Bug
Bug description:imagettftext not closing font file handle

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 bug report at https://bugs.php.net/bug.php?id=64822&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=64822&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=64822&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=64822&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=64822&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=64822&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=64822&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=64822&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=64822&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=64822&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=64822&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=64822&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=64822&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=64822&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64822&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=64822&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=64822&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=64822&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64822&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=64822&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=64822&r=mysqlcfg

Reply via email to