php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54520 Font in cifs mounted path causes "Could not read font" error
Submitted: 2011-04-13 12:40 UTC Modified: 2018-06-24 04:22 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: rpoca at androme dot es Assigned: cmb (profile)
Status: No Feedback Package: GD related
PHP Version: 5.3.6 OS: Linux Debian 6.0 Squeeze
Private report: No CVE-ID: None
 [2011-04-13 12:40 UTC] rpoca at androme dot es
Description:
------------
Trying to open a .ttf file in a CIFS mounted share (644 file permissions) causes
PHP Warning:  imagefttext(): Could not read font in 
/var/www/whatever/whatever/morewhatever/whatever/whatever/test.php on line 23

I tried to create the attached script (which sets GDFONTPATH to the current dir) 
to have a test. When run from /tmp with all the font files in the same directory, 
it works.

But when I moved into a CIFS mounted webroot, it stops working. It also fails when 
executing from the command line, from apache, as root, etc.



Test script:
---------------
<?php
$cwd = getcwd();
putenv("GDFONTPATH=$cwd");
// Note: You can find DejaVuSans.ttf on /usr/share/fonts/truetype/ttf-dejavu/
// if you "apt-get install ttf-dejavu"
$font1 = 'DejaVuSans.ttf';
$image = imagecreate( 400, 400 );
$bgcolor = imagecolorallocate($image, 255, 0, 0);
$color = imagecolorallocate($image, 255, 255, 0);
imagefttext( $image, 10, 0, 100, 100, $color, $font1, 'Test1');
header("Content-Type: image/png");
imagepng($image);
imagedestroy($image);
?>


Expected result:
----------------
Both on a cifs mounted drive and a normal path you should get the PNG image with 
the "Test1" string.

Actual result:
--------------
# php test.php
PHP Warning:  imagefttext(): Could not find/open font in 
/var/www/phemiumconsultant/portals/consultant/runtime3g/layouts/fonts/test.php on 
line 12
...PNG... binary data...


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-01-20 15:20 UTC] akger1379 at gmail dot com
I found a solution! It seems to be a problem of freetype...

Just mount the cifs with the "noserverinfo" option and it will work.

For more information:
https://savannah.gnu.org/bugs/?func=detailitem&item_id=31791

PS: I tried to write a comment to the linke above but I was not able to do so. Maybe someone else could push a bit to get this bug solved.
 [2018-04-04 13:30 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2018-04-04 13:30 UTC] cmb@php.net
> PHP Warning:  imagefttext(): Could not find/open font in 
> /var/www/phemiumconsultant/portals/consultant/runtime3g/layouts/fonts/test.php on 

If you set GDFONTPATH to this directory only, it is to be expected
that the font can't be found, unless the fontfile would also be
placed in this directory.

Also, please clarify which error message you actually get: "Could
not read font" or "Could not find/open font".
 [2018-06-24 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 11:01:30 2024 UTC