Calls to imagettftext cause fatal error in php

Bill Hernandez ms at mac-specialist.com
Sat Jul 5 23:56:11 PDT 2008


I'd be grateful if someone can confirm the problem below, and if so  
add a vote to get it fixed at http://bugs.php.net/bug.php?id=45437

In trying to setup "PHP Form image verification" I tried the example  
at http://www.reconn.us/content/view/28/49/, and could not get an  
image to display, so I tried example ( 1 ) found on http://us.php.net/imagettftext 
, and still could not get an image. So I launched the ZEND DEBUGGER,  
and found the problem.

When I trace Using ZEND DEBUGGER the call to imagettftext shows where  
the break in execution occurs.
Checking the Apache error log shows :
Break on  
__THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__ 
() to debug.
[Sun Jul 06 00:45:18 2008] [notice] child pid 2990 exit signal Trace/ 
BPT trap (5)

I posted a bug report:
http://bugs.php.net/bug.php?id=45437
Bug #45437	Calls to imagettftext crash

Same exact problem has been reported as Bug #44524, but has been  
written off as bogus.
IT IS NOT BOGUS...
Problem:
------------
Calls to imagettftext always fail with no error on Leopard 10.5.3
when run under MacPorts Apache 2.2.6, PHP 5.2.5 and the GD library.
Reproduce code:
---------------
<?php
// filename : random_image.php (called by <!-- filename  
random_sample.php --> )
// This is example ( 1 ) found on http://us.php.net/imagettftext
//Set the content-type
header("Content-type:image/png");

//Create the image
$image=imagecreatetruecolor(400,30);

//Create some colors
$white=imagecolorallocate($image,255,255,255);
$grey=imagecolorallocate($image,128,128,128);
$black=imagecolorallocate($image,0,0,0);
imagefilledrectangle($image,0,0,399,29,$white);

//The text to draw
$text='Testing...';
//Replace path by your own font path
// $font='fonts/10.ttf';
$font='/[path to font]/Arial.ttf';
//Add some shadow to the text
imagettftext($image,20,0,11,21,$grey,$font,$text);
//Addthetext
imagettftext($image,20,0,10,20,$black,$font,$text);

//Using imagepng()results in clearer text compared with imagejpeg()
imagepng($image);
imagedestroy($image);
?>
---------------------------------------------------------------------------

<?php
session_start();
?>
<!-- filename random_sample.php -->

<HTML>
<HEAD>
<TITLE>Random image sample</TITLE>
<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html;  
charset=iso-8859-1\">
</HEAD>
<BODY>
<?php
$errors=0;
if(isset($_POST['Submit']))
{
$number = $_POST['number'];
if(md5($number) != $_SESSION['image_value'])
echo '<h1>Validation string not valid! Please try again!</h1>';
else
{
echo '<h1>Your string is valid!</h1>';
//do something with the data
}
}
?>
<form name="form1" method="post" action="random_sample.php">
<table cellspacing="0" width="600" align="center">
<tr><td valign="top" align="right">Comments</td>
<td><input name="message" size=40 value="...your message here">
</td></tr>
<tr><td colspan=2 align="center">
<font size="1" face="Geneva, Arial, Helvetica, sans- 
serif"><strong><font size="2">
Please enter the string shown in the image in the form.<br> The  
possible characters are letters from A to Z in capitalized form and  
the numbers from 0 to 9.
</font></td></tr>
<tr><td align="center" colspan=2><input name="number" type="text" id= 
\"number\"></td></tr>
<tr><td colspan=2 align="center">
<img src="random_image.php">
<!-- <img src="random_image_sample.php"> -->
</td></tr>
<tr><td colspan=2 align="center"><input name="Submit" type="submit"
value="Submit"></td></tr>
</table>
</form>
</BODY>
</HTML>
---------------------------------------------------------------------------


Bill Hernandez
Plano, Texas


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-users/attachments/20080706/5223beb6/attachment.html 


More information about the macports-users mailing list