From:
Operating system: Linux Debian 6.0 Squeeze
PHP version: 5.3.6
Package: GD related
Bug Type: Bug
Bug description:Font in cifs mounted path causes "Could not read font" error
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 bug report at http://bugs.php.net/bug.php?id=54520&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=54520&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=54520&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=54520&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=54520&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=54520&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=54520&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=54520&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=54520&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=54520&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=54520&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=54520&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=54520&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=54520&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=54520&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54520&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54520&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=54520&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=54520&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=54520&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=54520&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=54520&r=mysqlcfg