php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66083 imagettfbox() returns different values
Submitted: 2013-11-12 16:44 UTC Modified: 2016-09-28 12:54 UTC
Votes:3
Avg. Score:4.0 ± 0.8
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:2 (100.0%)
From: michael at bigmichi1 dot de Assigned: cmb (profile)
Status: Closed Package: GD related
PHP Version: 5.5.5 OS: Ubuntu 13.10 / Win7
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: michael at bigmichi1 dot de
New email:
PHP Version: OS:

 

 [2013-11-12 16:44 UTC] michael at bigmichi1 dot de
Description:
------------
when i run the imagettfbox() under windows and also in linux with exactly the same parameters both calls return differnt results.

Linux:
gd

GD Support => enabled
GD Version => 2.1.1-dev
FreeType Support => enabled
FreeType Linkage => with freetype
FreeType Version => 2.4.12
GIF Read Support => enabled
GIF Create Support => enabled
JPEG Support => enabled
libJPEG Version => 8
PNG Support => enabled
libPNG Version => 1.2.49
WBMP Support => enabled
XPM Support => enabled
libXpm Version => 30411
XBM Support => enabled
WebP Support => enabled

Directive => Local Value => Master Value
gd.jpeg_ignore_warning => 0 => 0


Windows:
gd

GD Support => enabled
GD Version => bundled (2.1.0 compatible)
FreeType Support => enabled
FreeType Linkage => with freetype
FreeType Version => 2.4.10
GIF Read Support => enabled
GIF Create Support => enabled
JPEG Support => enabled
libJPEG Version => unknown
PNG Support => enabled
libPNG Version => 1.5.14
WBMP Support => enabled
XPM Support => enabled
libXpm Version => 30411
XBM Support => enabled
WebP Support => enabled

Directive => Local Value => Master Value
gd.jpeg_ignore_warning => 0 => 0


Linux:
PHP Version => 5.5.5-1chl1~saucy1

System => Linux i920 3.11.0-13-generic #20-Ubuntu SMP Wed Oct 23 07:38:26 UTC 2013 x86_64
Build Date => Oct 21 2013 21:01:50
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /etc/php5/cli
Loaded Configuration File => /etc/php5/cli/php.ini
Scan this dir for additional .ini files => /etc/php5/cli/conf.d
Additional .ini files parsed => /etc/php5/cli/conf.d/05-opcache.ini,
/etc/php5/cli/conf.d/10-pdo.ini,
/etc/php5/cli/conf.d/20-curl.ini,
/etc/php5/cli/conf.d/20-gd.ini,
/etc/php5/cli/conf.d/20-geoip.ini,
/etc/php5/cli/conf.d/20-gmp.ini,
/etc/php5/cli/conf.d/20-imagick.ini,
/etc/php5/cli/conf.d/20-intl.ini,
/etc/php5/cli/conf.d/20-ldap.ini,
/etc/php5/cli/conf.d/20-mcrypt.ini,
/etc/php5/cli/conf.d/20-mongo.ini,
/etc/php5/cli/conf.d/20-mysql.ini,
/etc/php5/cli/conf.d/20-mysqli.ini,
/etc/php5/cli/conf.d/20-pdo_mysql.ini,
/etc/php5/cli/conf.d/20-pdo_pgsql.ini,
/etc/php5/cli/conf.d/20-pdo_sqlite.ini,
/etc/php5/cli/conf.d/20-pgsql.ini,
/etc/php5/cli/conf.d/20-readline.ini,
/etc/php5/cli/conf.d/20-sqlite3.ini,
/etc/php5/cli/conf.d/20-tidy.ini,
/etc/php5/cli/conf.d/20-xdebug.ini,
/etc/php5/cli/conf.d/20-xmlrpc.ini,
/etc/php5/cli/conf.d/20-xsl.ini

PHP API => 20121113
PHP Extension => 20121212
Zend Extension => 220121212
Zend Extension Build => API220121212,NTS
PHP Extension Build => API20121212,NTS
Debug Build => no
Thread Safety => disabled
Zend Signal Handling => disabled
Zend Memory Manager => enabled
Zend Multibyte Support => provided by mbstring
IPv6 Support => enabled
DTrace Support => disabled

Registered PHP Streams => https, ftps, compress.zlib, compress.bzip2, php, file, glob, data, http, ftp, phar, zip
Registered Stream Socket Transports => tcp, udp, unix, udg, ssl, sslv3, tls
Registered Stream Filters => zlib.*, bzip2.*, convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk, mcrypt.*, mdecrypt.*

This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
    with Zend OPcache v7.0.3-dev, Copyright (c) 1999-2013, by Zend Technologies
    with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans


Windows:
PHP Version => 5.5.5

System => Windows NT LAPTOP 6.1 build 7601 (Windows 7 Home Premium Edition Service Pack 1) AMD64
Build Date => Oct 15 2013 11:43:22
Compiler => MSVC11 (Visual C++ 2012)
Architecture => x64
Configure Command => cscript /nologo configure.js  "--enable-snapshot-build" "--enable-debug-pack" "--disable-zts" "--disable-isapi" "--disable-nsapi" "--without-mssql" "--without-pd
o-mssql" "--without-pi3web" "--with-pdo-oci=C:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8=C:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8-11g=C:\php-sdk\oracl
e\instantclient11\sdk,shared" "--with-enchant=shared" "--enable-object-out-dir=../obj/" "--enable-com-dotnet=shared" "--with-mcrypt=static" "--disable-static-analyze" "--with-pgo"
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => C:\Windows
Loaded Configuration File => C:\Users\Michael\Dropbox\pear\php\5.5\php.ini
Scan this dir for additional .ini files => (none)
Additional .ini files parsed => (none)
PHP API => 20121113
PHP Extension => 20121212
Zend Extension => 220121212
Zend Extension Build => API220121212,NTS,VC11
PHP Extension Build => API20121212,NTS,VC11
Debug Build => no
Thread Safety => disabled
Zend Signal Handling => disabled
Zend Memory Manager => enabled
Zend Multibyte Support => disabled
IPv6 Support => enabled
DTrace Support => disabled

Registered PHP Streams => php, file, glob, data, http, ftp, zip, compress.zlib, https, ftps, phar
Registered Stream Socket Transports => tcp, udp, ssl, sslv3, sslv2, tls
Registered Stream Filters => convert.iconv.*, mcrypt.*, mdecrypt.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk, zlib.*

This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
    with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans

Test script:
---------------
$bounds = imagettfbbox(12, 0, "Vera.ttf", "one");
print_r($bounds);

Expected result:
----------------
both calls return the same result regardless of the operating system

Actual result:
--------------
Windows:
(
    [0] => -1
    [1] => -1
    [2] => 26
    [3] => -1
    [4] => 26
    [5] => -10
    [6] => -1
    [7] => -10
)

Linux:
(
    [0] => -1
    [1] => 0
    [2] => 30
    [3] => 0
    [4] => 30
    [5] => -11
    [6] => -1
    [7] => -11
)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-03-31 11:36 UTC] mplomer at gmx dot de
For proposed fix and further info/discussion, see bug #53504
 [2016-09-23 14:40 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2016-09-23 14:40 UTC] cmb@php.net
Please try with a current PHP snapshot and the bundled GD.
 [2016-09-27 11:28 UTC] michael at bigmichi1 dot de
tried with the 7.1-dev with bundled gd but still different outputs.


win:
PHP 7.1.0-dev (cli) (built: Sep 26 2016 21:23:33) ( NTS MSVC14 (Visual C++ 2015) x64 )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies

gd

GD Support => enabled
GD Version => bundled (2.1.0 compatible)
FreeType Support => enabled
FreeType Linkage => with freetype
FreeType Version => 2.6.2
GIF Read Support => enabled
GIF Create Support => enabled
JPEG Support => enabled
libJPEG Version => 9 compatible
PNG Support => enabled
libPNG Version => 1.6.21
WBMP Support => enabled
XPM Support => enabled
libXpm Version => 30411
XBM Support => enabled
WebP Support => enabled
                  

Array
(
    [0] => 1
    [1] => 0
    [2] => 28
    [3] => 0
    [4] => 28
    [5] => -9
    [6] => 1
    [7] => -9
)


linux:
PHP 7.1.0RC1 (cli) (built: Sep 27 2016 13:10:41) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.1.0-dev, Copyright (c) 1998-2016 Zend Technologies

gd

GD Support => enabled
GD Version => bundled (2.1.0 compatible)
FreeType Support => enabled
FreeType Linkage => with freetype
FreeType Version => 2.6.1
GIF Read Support => enabled
GIF Create Support => enabled
PNG Support => enabled
libPNG Version => 1.2.54
WBMP Support => enabled
XBM Support => enabled

Array
(
    [0] => -1
    [1] => -1
    [2] => 26
    [3] => -1
    [4] => 26
    [5] => -10
    [6] => -1
    [7] => -10
)
 [2016-09-27 11:46 UTC] cmb@php.net
Thanks for testing!

I assume these differences are caused by different libfreetype
versions/configurations. On Windows you're probably using
libfreetype 2.6.2 (or something close to that). Which libfreetype
version do you use on Linux? There are known (but unresolved)
issues with libfreetype 2.5.x-ubuntu.
 [2016-09-27 12:10 UTC] michael at bigmichi1 dot de
linux uses libfreetype 2.6.1
windows uses libfreetype 2.6.2
 [2016-09-27 13:16 UTC] cmb@php.net
Thanks!

Can you please supply a minimal self-contained reproduce script?
If there is a non-standard font involved, please make this
available for download somewhere, too.
 [2016-09-28 05:06 UTC] michael at bigmichi1 dot de
font file can be found here:
http://www.dafont.com/de/bitstream-vera-sans.font

reproducer:
<?php
$bounds = imagettfbbox(12, 0, "Vera.ttf", "one");
print_r($bounds);
 [2016-09-28 11:51 UTC] cmb@php.net
-Status: Feedback +Status: Open
 [2016-09-28 11:51 UTC] cmb@php.net
Thanks. I'll have a look at it ASAP.
 [2016-09-28 12:22 UTC] cmb@php.net
-Status: Assigned +Status: Feedback
 [2016-09-28 12:22 UTC] cmb@php.net
> PHP 7.1.0-dev (cli) (built: Sep 26 2016 21:23:33) ( NTS MSVC14
> (Visual C++ 2015) x64 )

> PHP 7.1.0RC1 (cli) (built: Sep 27 2016 13:10:41) ( NTS )

Ah, we're comparing apples and oranges here. :-)

Note that the fix for 53504 is not contained in any QA release of
PHP 7.1 yet; it is scheduled for PHP 7.1.0RC3 only.

Running with current Windows 7.1 snapshots and the current 7.1
head on Linux both produces:

Array
(
    [0] => 1
    [1] => 0
    [2] => 28
    [3] => 0
    [4] => 28
    [5] => -9
    [6] => 1
    [7] => -9
)

You can download the current 7.1 head via
<https://github.com/php/php-src/archive/PHP-7.1.zip>. Please try
this one on Linux.
 [2016-09-28 12:48 UTC] michael at bigmichi1 dot de
with the version you linked to i got the same results like on windows
 [2016-09-28 12:54 UTC] cmb@php.net
-Status: Feedback +Status: Closed
 [2016-09-28 12:54 UTC] cmb@php.net
Thanks. So I assume we can close this ticket.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 14:01:29 2024 UTC