php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16317 ImageTTF* functions segfault under mod_php4 php 4.1.2 gd freetype2
Submitted: 2002-03-27 14:11 UTC Modified: 2002-03-27 14:17 UTC
From: shamim at poetryunlimited dot com Assigned:
Status: Not a bug Package: GD related
PHP Version: 4.1.2 OS: Linux-Mandrake
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: shamim at poetryunlimited dot com
New email:
PHP Version: OS:

 

 [2002-03-27 14:11 UTC] shamim at poetryunlimited dot com
The test program below, segfaults under mod_php4 from apache, but succeeds at the command line.

Running Linux-Mandrake 8.2 on Duron 700 266 FSB w/ php 4.1.2 and Zend optimizer 1.2.0 optimized to 65535 (pass 9 and 10 and 11)

Installed:
apache-conf-1.3.23-4mdk
apache-suexec-1.3.23-3mdk
apache-modules-1.3.23-4mdk
apache-mod_perl-1.3.23_1.26-5mdk
apache-manual-1.3.23-4mdk
apache-devel-1.3.23-4mdk
apache-1.3.23-4mdk
apache-common-1.3.23-4mdk
apache-source-1.3.20-3mdk
php-imap-4.1.2-1mdk
php-manual_en-4.1.1-1mdk
php-xml-4.1.2-1mdk
php-common-4.1.2-1mdk
php-mysql-4.1.2-2mdk
php-readline-4.1.2-1mdk
php-4.1.2-1mdk
php-dba_gdbm_db3-4.1.2-1mdk
php-ldap-4.1.2-1mdk
php-gd-4.1.2-1mdk
php-pgsql-4.1.2-1mdk
mod_php-4.1.2-1mdk
php-devel-4.1.2-1mdk
libgd1-devel-1.8.4-4mdk
libgd1-1.8.4-4mdk
freetype-tools-1.3.1-12mdk
freetype-1.3.1-12mdk
freetype-devel-1.3.1-12mdk
freetype2-2.0.4-1mdk
freetype2-devel-2.0.4-1mdk

http://reality.poetryunlimited.com:81/testvars - list of php settings
and modules

http://new.poetryunlimited.com:81/testbug.php3 -fails miserably.

php testbug.php3 generates image perfectly. Copy of saved image located
at http://new.poetryunlimited.com:81/images/myimg.png

Font directory cannot even be relative or font loading fails - preferred
earlier GD preferences - where can we set the GDFONTPATH env variable
per server? Can we use a full path outside of the apache tree???

Any font file can be used in place of the ttf I have placed below. If
the ttf is requried it can be retrieved from
http://new.poetryunlimited.com:81/font/bluebold.ttf

testbug.php3 follows

<?php
$imagewidth = 100;
$imageheight = 20;
$fontsize = 12;
$myimg=ImageCreate($imagewidth, $imageheight);
$col1=ImageColorAllocate($myimg, 255, 0, 0);
$col2=ImageColorAllocate($myimg, 255, 255, 255);
$thetextbox = ImageTTFBBox ($fontsize, 0,
"/home/httpd/html/new/font/bluebold.ttf", "My Button");
$textwidth = (($thetextbox[4] + $thetextbox[2]) / 2) - (($thetextbox[6]
+
$thetextbox[0]) / 2);
$xpos = ($imagewidth - $textwidth) / 2;
$ypos = 14;
ImageTTFText ($myimg, $fontsize, 0, $xpos, $ypos, $col2,
"/home/httpd/html/new/font/bluebold.ttf", "My Button");
ImagePNG($myimg, "myimg.png");
ImageDestroy($myimg);
?>
<img src="myimg.png" border=0>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-03-27 14:17 UTC] sander@php.net
Please, do NOT submit bugs more than once. See #16300.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 20:01:36 2025 UTC