Bug #54520 [Opn->Fbk]: Font in cifs mounted path causes "Could not read font" error

From: Date: Wed, 04 Apr 2018 13:30:09 +0000
Subject: Bug #54520 [Opn->Fbk]: Font in cifs mounted path causes "Could not read font" error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-214592@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=54520&edit=1

 ID:                 54520
 Updated by:         cmb@php.net
 Reported by:        rpoca at androme dot es
 Summary:            Font in cifs mounted path causes "Could not read
                     font" error
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            GD related
 Operating System:   Linux Debian 6.0 Squeeze
 PHP Version:        5.3.6
-Assigned To:        
+Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

> 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".


Previous Comments:
------------------------------------------------------------------------
[2012-01-20 15:20:52] 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.

------------------------------------------------------------------------
[2011-04-13 12:40:37] 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...



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=54520&edit=1


Thread (4 messages)

« previous php.bugs (#214592) next »