php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40946 Use of newer GD install prevents text functions from working.
Submitted: 2007-03-29 10:01 UTC Modified: 2007-07-24 01:00 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: gfrank at neoservers dot com Assigned: pajoye (profile)
Status: No Feedback Package: GD related
PHP Version: 4.4.6 OS: Linux 2.6.20
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2007-03-29 10:01 UTC] gfrank at neoservers dot com
Description:
------------
When using the latest stable release of GD 2.0.34 instead of the bundled version, functions which require text generate an error.

The issue was present on not just the provided code below but on every single piece of code we had that used ANY function that accessed a font.  It claims the font didn't exist or couldn't be opened.  As soon as we went back to the bundled GD, it started working again.

I'm not sure if this is an issue with PHP not being compatible with the newer GD or if this is a bug in GD.

Configure String:

 ./configure    --prefix=/usr    --libdir=/usr/lib64    --localstatedir=/var/lib/php    --with-apxs2=/usr/apache/bin/apxs    --with-zlib-dir=/usr    --with-bz2=/usr    --enable-calendar    --with-jpeg-dir=/usr    --enable-ftp    --with-gd=/usr    --with-ttf    --with-freetype-dir=/usr    --enable-gd-native-ttf    --with-png-dir=/usr    --with-gettext=/usr    --with-mysql=/usr    --with-curlwrappers    --enable-sockets    --enable-versioning    --enable-track-vars    --enable-trans-sid    --enable-bcmath    --enable-mbstring    --disable-debug    --enable-sysvshm    --enable-sysvsem    --enable-shmop  

Reproduce code:
---------------
http://www.animeforum.com/jakiao/code.phps

Expected result:
----------------
http://www.tuxeodmask.com/sig/blah.html (the images beneath "back to list" and above "Hi Bob")

Actual result:
--------------
PHP Warning:  imagettfbbox(): Could not find/open font in /home/kaitou/tuxedomask.com/sig/sig2.jpg on line 150

Warning: imagettfbbox(): Could not find/open font in /home/kaitou/tuxedomask.com/sig/sig2.jpg on line 150
PHP Warning:  imagettftext(): Could not find/open font in /home/kaitou/tuxedomask.com/sig/sig2.jpg on line 161

Warning: imagettftext(): Could not find/open font in /home/kaitou/tuxedomask.com/sig/sig2.jpg on line 161
PHP Warning:  imagettftext(): Could not find/open font in /home/kaitou/tuxedomask.com/sig/sig2.jpg on line 162

Warning: imagettftext(): Could not find/open font in /home/kaitou/tuxedomask.com/sig/sig2.jpg on line 162
?PNG

IHDR    l?\V    PLTE,m??????++RNS@??f
                                     IDA?c`??+][IEND?B`?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-03-29 11:07 UTC] pajoye@php.net
"I'm not sure if this is an issue with PHP not being compatible with the newer GD or if this is a bug in GD."

It is not really a bug, not in php neither in GD. Environment like apache requires an absolute path as the CWD differs. The problem is solved by PHP internal functions. the php CWD is used by php functions.

Add:

$font = realpath($font);

Question, why do you want to use the external GD? 2.0.34 has not all new functions and improvements available in the bundled GD (but all bug fixes). I strongly recommend to use the bundled GD with php.

 [2007-03-29 19:30 UTC] gfrank at neoservers dot com
We actually did try specifying an absolute path to the font, and it still wouldn't work.  The exact same code, however, worked with the bundled GD without issue.

The reason we were trying the external GD was due to a string of glibc errors causing the system to crash, and after a lot of investigating we had reason to believe that the issue lied within GD as we heavily rely on it.

Later this week I will recompile PHP back to the alternate config using the external GD and try your suggestion.  If that also produces errors, would you like me to respond?

Thank you.
 [2007-03-30 01:12 UTC] pajoye@php.net
"We actually did try specifying an absolute path to the font, and it
still wouldn't work."

Which web server do you use (and version, threaded or not)?

"The reason we were trying the external GD was due to a string of glibc
errors causing the system to crash, and after a lot of investigating we
had reason to believe that the issue lied within GD as we heavily rely
on it."

Which error do you get? Do you have a backtrace?

Do you get this error using the bundled GD? (compiled using "--with-gd") Can you also try using a 4.4 snapshot (http://snaps.php.net/)?

"would you like me to respond?"

yes, please.
 [2007-03-30 02:04 UTC] gfrank at neoservers dot com
"Which web server do you use (and version, threaded or not)?"

Apache 2.2.4, non-threaded (prefork)

"Which error do you get? Do you have a backtrace?"

Lots of:

*** glibc detected *** double free or corruption (!prev): 0x00002aaaaad9b120 ***
*** glibc detected *** malloc(): memory corruption: 0x00002aaab08abba0 ***
*** glibc detected *** double free or corruption (out): 0x00002aaaad465c70 ***
*** glibc detected *** malloc(): memory corruption (fast): 0x00002aaaad465d50 ***
*** glibc detected *** double free or corruption (fasttop): 0x0000000001f3c7f0 ***
*** glibc detected *** double free or corruption (fasttop): 0x00002aaaad064920 ***
*** glibc detected *** double free or corruption (fasttop): 0x0000000001bc1ab0 ***
*** glibc detected *** double free or corruption (fasttop): 0x00002aaaac004c40 ***
*** glibc detected *** double free or corruption (!prev): 0x0000000000c5b370 ***
*** glibc detected *** double free or corruption (out): 0x0000000003d6ca50 ***
*** glibc detected *** double free or corruption (out): 0x00002aaaaf831df0 ***

System would crash sometimes with the "double free or corruption (fasttop)" messages, but not always.  The rest only seem to kill that specific child.  Tracking the access_log for the times of the error points us to GD but it's virtually impossible to use that to determine what exactly caused it as there would be 60 or so different requests spanning virtually all of our services.

"Do you get this error using the bundled GD? (compiled using
"--with-gd") Can you also try using a 4.4 snapshot
(http://snaps.php.net/)?"

The error with text is NOT present in the bundled GD.  It's only an issue with external GD (have tested 2.0.34 and 2.0.35RC2).  What I will do is test the latest PHP snapshot with the external GD install.  I'll post my results, tho it may be a few days before I can find the time to do this.

Thanks.
 [2007-03-30 02:07 UTC] gfrank at neoservers dot com
Oh, as for if I have a stack trace: Working on getting one.  ulimit doesn't want to cooperate, but I'll have one sometime soon.  The last few times a crash happened the system stalled out before a crashdump could be sent out (so much for my attempts to kill Apache before this happened).
 [2007-07-16 11:13 UTC] pajoye@php.net
Set to feedback.
 [2007-07-24 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 12 15:01:30 2024 UTC