From:             ctcrmcou at opm dot gov
Operating system: W7
PHP version:      Irrelevant
Package:          GD related
Bug Type:         Bug
Bug description:imagettfbbox loads wrong fontname if using ../ and underscore 
in font name

Description:
------------
Assuming a subdirectory named "fonts" contains 30 fonts named font_1.ttf -
font_30.ttf, calling imagettfbox with a fontname such as
"../fonts/font_10.ttf" loads incorrect font, the number part is somehow
being altered and the wrong font is loading.

Somehow the combination of ../ and _ in the finename param are screwing
things up.  This is not a file/font not found error.  This is the font that
loads font_13.ttf is actually loading font_14.ttf, or font_28.ttf is
loading font_10.ttf.  I can only guess the underscore is changing the
meaning of the number or the number is being converted.

Test script:
---------------
Works:

$box=imagettfbbox(100,0,"fonts/font_10.ttf","some text");

Doesn't work (wrong font loads):

$box=imagettfbbox(100,0,"../fonts/font_10.ttf","some text");

Workaround 1: remove underscore from font names

$box=imagettfbbox(100,0,"../fonts/font10.ttf","some text");

Workaround 2: move app that loads font to higher directory level (no ../ in
path)

$box=imagettfbbox(100,0,"fonts/font_10.ttf","some text");




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

Reply via email to