php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64314 imagettfbbox loads wrong fontname if using ../ and underscore in font name
Submitted: 2013-02-27 20:28 UTC Modified: 2016-09-18 04:22 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: ctcrmcou at opm dot gov Assigned: cmb (profile)
Status: No Feedback Package: GD related
PHP Version: Irrelevant OS: W7
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ctcrmcou at opm dot gov
New email:
PHP Version: OS:

 

 [2013-02-27 20:28 UTC] ctcrmcou at opm dot gov
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");




Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-02-28 22:15 UTC] mail+php at requinix dot net
This is quite unusual, to see a filename being treated differently depending whether it has an underscore. Can you include a complete, 
hopefully smallish script demonstrating the problem? That way someone (like me) can grab a handful of font files and look for the cause.
 [2013-02-28 22:26 UTC] ctcrmcou at opm dot gov
I'd be happy to but it will be a few days before I can get to it.
 [2016-09-04 16:10 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2016-09-04 16:10 UTC] cmb@php.net
I can't reproduce this issue, but this part of GD is highly
configurable/system dependent. Please post at least the output of
gd_info(), and the PHP version you use, and clarify OS=W7; do you
mean Windows 7?
 [2016-09-18 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 12:01:30 2024 UTC