php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52404 All TTF Files are invalid [ALL PHP.NET]
Submitted: 2010-07-22 15:13 UTC Modified: 2013-12-27 01:25 UTC
Votes:5
Avg. Score:4.0 ± 0.9
Reproduced:5 of 5 (100.0%)
Same Version:4 (80.0%)
Same OS:3 (60.0%)
From: hm2k@php.net Assigned:
Status: Wont fix Package: Website problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: hm2k@php.net
New email:
PHP Version: OS:

 

 [2010-07-22 15:13 UTC] hm2k@php.net
Description:
------------
All of the TTF files that are on PHP.net appear to be invalid/corrupt.

A change that happened 12 months ago with the description of "Fix TTF files" appears to be where the problem lies.

http://svn.php.net/viewvc?view=revision&revision=284292

To fix this, this revision should be reverted to all files.

On Windows, when you try to open any of these files it will say

"The requested file *.ttf was not a valid font file".

Here at PHP, we get a different message when using the imagettfbbox() function...

"Could not read font".

In the example below I am using the arial.ttf file which can be downloaded here:
http://svn.php.net/viewvc/web/php/trunk/bin/arial.ttf?view=co

Test script:
---------------
<?php

$font = 'fonts/arial.ttf';

$read = file_exists($font)?'Yes':'No';
echo "\n<br>Does font '$font' exist? ".$read;

$read = is_readable($font)?'Yes':'No';
echo "\n<br>Is font '$font' readable? ".$read;

$test = @imagettfbbox(1, 1, $font, 1)?'Yes':'No';
echo "\n<br>Is font '$font' valid? ".$test;

echo "\n<br>What PHP version? ".phpversion();

?>

Expected result:
----------------
Does font 'fonts/arial.ttf' exist? Yes
Is font 'fonts/arial.ttf' readable? Yes
Is font 'fonts/arial.ttf' valid? Yes
What PHP version? 5.2.13

Actual result:
--------------
Does font 'fonts/arial.ttf' exist? Yes
Is font 'fonts/arial.ttf' readable? Yes
Is font 'fonts/arial.ttf' valid? No
What PHP version? 5.2.13

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-07-27 01:02 UTC] kalle@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: rasmus
 [2010-07-27 01:02 UTC] kalle@php.net
Confirmed on Windows XP aswell (unreadable font files in the font viewer)

Rasmus: You did this change, should it be reverted or do you have any easy fix on your mind?
 [2010-07-27 01:54 UTC] rasmus@php.net
You may just have to re-import them into Subversion or something.  All I did was 
flip the svn property so Subversion wouldn't mangle them.
 [2010-10-18 18:30 UTC] hm2k@php.net
I would if I could.

I don't think I have commit access to all of the ttf files on the php.net svn.
 [2010-12-07 12:51 UTC] hm2k@php.net
-Status: Assigned +Status: Open -Assigned To: rasmus +Assigned To:
 [2010-12-07 12:51 UTC] hm2k@php.net
This is not a difficult bug to fix. Anybody with commit access should be able to fix it.

Can somebody fix it?

Thanks.
 [2011-06-12 03:32 UTC] gozmeu at gmail dot com
same here 

Warning: imagettftext() [function.imagettftext]: Could not find/open font in /home/gozmeu/domains/pwiguilds.com/public_html/travelcounter.php on line 40
‰PNG  IHDRPÆ-q" PLTEÿÿÿÿÿÿsx¥cIDAT(‘cpÀ±,»ÊQ3GÍÄk&]7>7¡ˆFIEND®B`‚


with a valid or invalid ttf file :s
 [2011-12-12 13:58 UTC] clockwerx@php.net
This... doesn't seem to be just those .ttf files. I grabbed 
http://ftp.gnome.org/pub/GNOME/sources/ttf-bitstream-vera/1.10/ and there's no 
differences against http://github.com/pear/Image_Text/tests/

Trying to open these; I get:
 imagettfbbox(): Could not read font
 [2011-12-12 18:43 UTC] hm2k@php.net
Comment:
------------
I was unable to replicate clockwerx's findings.

According to my results there is only a problem with the fonts changed by rasmus 
in r284292.

New test script:
------------
<?php

$fonts=array();

//from https://github.com/pear/Image_Text/raw/master/tests/Vera.ttf
$fonts[]='fonts/Vera.ttf';

//from http://ftp.gnome.org/pub/GNOME/sources/ttf-bitstream-vera/1.10/ttf-
bitstream-vera-1.10.zip
$fonts[] = 'fonts/ttf-bitstream-vera-1.10/Vera.ttf';

foreach ($fonts as $font) {
    $read = file_exists($font)?'Yes':'No';
    echo "Does font '$font' exist? $read\n<br>";

    $read = is_readable($font)?'Yes':'No';
    echo "Is font '$font' readable? $read\n<br>";

    $test = @imagettfbbox(1, 1, $font, 1)?'Yes':'No';
    echo "Is font '$font' valid? $test\n<br>";

    echo "What PHP version? ".phpversion()."\n<br>";

    echo "\n<br>";
}
?>

Results:
------------
Here's the results of that:

Does font 'fonts/Vera.ttf' exist? Yes 
Is font 'fonts/Vera.ttf' readable? Yes 
Is font 'fonts/Vera.ttf' valid? No 
What PHP version? 5.3.4 

Does font 'fonts/ttf-bitstream-vera-1.10/Vera.ttf' exist? Yes 
Is font 'fonts/ttf-bitstream-vera-1.10/Vera.ttf' readable? Yes 
Is font 'fonts/ttf-bitstream-vera-1.10/Vera.ttf' valid? Yes 
What PHP version? 5.3.4

Conclusion:
------------
In r284292 rasmus made a change which changed the EOL of these font files. These 
files use a "Mixed" EOL while the original files use just Unix type EOL.

Solution:
------------
Roll back r284292.
 [2013-12-05 19:47 UTC] mike@php.net
-Package: *General Issues +Package: Website problem
 [2013-12-27 01:25 UTC] bjori@php.net
-Status: Open +Status: Wont fix
 [2013-12-27 01:25 UTC] bjori@php.net
Why are you downloading these fonts from our servers?

Do we link to them somewhere for something?

I recently removed them from phpweb as I couldn't see them used with anything.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Nov 04 11:01:29 2024 UTC