Bug #51315 [Asn]: imagettfbbox randomly don't work

From: Date: Tue, 23 Mar 2010 19:59:14 +0000
Subject: Bug #51315 [Asn]: imagettfbbox randomly don't work
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-148909@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=51315&edit=1

 ID:               51315
 Updated by:       geissert@php.net
 Reported by:      administrateur at exinsidephp dot com
 Summary:          imagettfbbox randomly don't work
 Status:           Assigned
 Type:             Bug
 Package:          GD related
 Operating System: Debian GNU/Linux 5.0
 PHP Version:      5.3.2
 Assigned To:      geissert

 New Comment:

Strange that you mention that it works with gcc 4.1.2. Last I heard
5.3.x failed to build with that version (don't know what arch was that,
though).

Will take a look at it later. FWIW, a test related to imagettfbbox is
reproducibly failing (with the same results on all archs):

ext/gd/tests/bug48801.log:
---- EXPECTED OUTPUT
(-1, 15)
(155, 15)
(155, -48)
(-1, -48)
---- ACTUAL OUTPUT
(1, 15)
(163, 15)
(163, -48)
(1, -48)
---- FAILED

And that was with 4.4.3 (same results without optimisation). Has anyone
tried to reproduce it with the same or similar versions of gcc from
another distribution?


Previous Comments:
------------------------------------------------------------------------
[2010-03-23 15:04:59] pajoye@php.net

Raphael, can you take a look at this one please?

------------------------------------------------------------------------
[2010-03-23 14:52:53] administrateur at exinsidephp dot com

So I have find the origin of the problem : "GCC".

This problem appear if you compile PHP 5.3.2 width GCC 4.3.2 on Debian
32 bits. For fix the problem you must compile PHP 5.3.2 width GCC 4.1.2.

------------------------------------------------------------------------
[2010-03-19 16:36:19] administrateur at exinsidephp dot com

rechange title

------------------------------------------------------------------------
[2010-03-19 16:35:50] administrateur at exinsidephp dot com

So I have add debug line and i find origin of bug :

View my previous script an modify width this line :

$tab =
imagettfbbox(8,0,Config::getCons('PATH_CACHE').'font/verdana.TTF',
$texte);
$text_x = (55-($tab[2]-$tab[6]))/2;
$text_y = (15-($tab[1]-$tab[5]))/2+9;

file_put_contents(Config::getCons('PATH_CACHE').'log_font.txt', $text.'
x:'.$text_x.' y:'.$text_y.'
imagbox:'.json_encode($tab)."\n",FILE_APPEND);


The result : 

 x:12 y:12.5 imagbox:[-1,-1,30,-1,30,-9,-1,-9]
 x:33554459 y:12.5
imagbox:[-1,-1,-33554433,-1,-33554433,-9,33554430,-9]
 x:33554459 y:12.5
imagbox:[-1,-1,-33554433,-1,-33554433,-9,33554430,-9]
 x:33554459 y:12.5
imagbox:[-1,-1,-33554433,-1,-33554433,-9,33554430,-9]
 x:12 y:12.5 imagbox:[-1,-1,30,-1,30,-9,-1,-9]
 x:12 y:12.5 imagbox:[-1,-1,30,-1,30,-9,-1,-9]
 x:12 y:12.5 imagbox:[-1,-1,30,-1,30,-9,-1,-9]
 x:12 y:12.5 imagbox:[-1,-1,30,-1,30,-9,-1,-9]
 x:12 y:12.5 imagbox:[-1,-1,30,-1,30,-9,-1,-9]
 x:12 y:12.5 imagbox:[-1,-1,30,-1,30,-9,-1,-9]
 x:33554459 y:12.5
imagbox:[-1,-1,-33554433,-1,-33554433,-9,33554430,-9]
 x:12 y:12.5 imagbox:[-1,-1,30,-1,30,-9,-1,-9]

So the problem is located on imagettfbbox funtion, it give wrong value
for x position.

------------------------------------------------------------------------
[2010-03-19 16:26:47] administrateur at exinsidephp dot com

Change title of bug

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    http://bugs.php.net/bug.php?id=51315


-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51315&edit=1


Thread (16 messages)

« previous php.bugs (#148909) next »