From:             choinet at rocketmail dot com
Operating system: Windows/Linux
PHP version:      4.3.4
PHP Bug Type:     GD related
Bug description:  Spaces in Font Pathnames

Description:
------------
This report stems from bug report #26635, where spaces are not allowed in
the pathname. There are more details towards the end of that report
(http://bugs.php.net/26635) as to how I am sure that pathnames with spaces
do not work.

In fact, I have found out that spaces in the fontfile argument gd
functions, such as imagettftext() are used to denote multiple fonts, which
explains why trying to open pathnames with spaces in them did not work. I
have found this by inserting two working paths into the fontfile argument
of the above function and alternating their order to verify that they are
both being opened correctly.

What I am wondering is if there can be a different font list separator
character than a space, such as &, that is not used in the directory
naming convention to delimit the fonts specified in the fontfile argument,
so that users may link to a font file with a space-containing pathname.

Reproduce code:
---------------
<?php
$image = imagecreate(100, 100);

// Example 1: no spaces in pathname
$path = 'c:\arial.ttf';
imagettftext($image, 12, 0, 50, 50, $color, $path, "Hello");

// Example 2: space in pathname
$path = 'c:\test folder\arial.ttf';
imagettftext($image, 12, 0, 50, 50, $color, $path, "Hello");

// Example 3: no spaces in multiple font pathnames
$path = 'c:\arial.ttf';
$path2 = 'c:\cour.ttf';
imagettftext($image, 12, 0, 50, 50, $color, "$path $path2", "Hello");
//note the space between the two pathnames

// Example 4: spaces in multiple font pathnames
$path = 'c:\test folder\arial.ttf';
$path2 = 'c:\test folder\cour.ttf';
imagettftext($image, 12, 0, 50, 50, $color, "$path $path2", "Hello");
//note the space between the two pathnames
?>

Expected result:
----------------
I expect no errors in each case.

Actual result:
--------------
(Taking each example one at a time by commenting out the others)
Example 1:
(no error)

Example 2:
Warning: imagettftext(): Could not find/open font in C:\Program
Files\Apache Group\Apache2\htdocs\index.php on line 10

Example 3:
(no error)

Example 4:
Warning: imagettftext(): Could not find/open font in C:\Program
Files\Apache Group\Apache2\htdocs\index.php on line 20

-- 
Edit bug report at http://bugs.php.net/?id=26764&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=26764&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=26764&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=26764&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=26764&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=26764&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=26764&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=26764&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=26764&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=26764&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=26764&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=26764&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=26764&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26764&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=26764&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=26764&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=26764&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26764&r=float

Reply via email to