Edit report at https://bugs.php.net/bug.php?id=42218&edit=1
ID: 42218
Comment by: shenkong at qq dot com
Reported by: fernando at barnatech dot com
Summary: ImageTTFBBox & any2eucjp
Status: No Feedback
Type: Bug
Package: GD related
Operating System: Suse 10.2
PHP Version: 5.2.4RC1
Assigned To: pajoye
Block user comment: N
Private report: N
New Comment:
same problem.
Warning: imagettfbbox(): any2eucjp(): invalid code in input string in
/media/psf/pf/lib/ImageChart/LineChart.class.php on line 551
os:centos 7
file encoding:utf-8
textï¼æ é¢ in chinese
font:msyh.ttf (Microsoft YaHei)
phpver:5.5.14
extver:
curl-7.37.0.tar.gz
freetype-2.5.3.tar.bz2
jpegsrc.v9a.tar.gz
libevent-2.0.21-stable.tar.gz
libmcrypt-2.5.8.tar.gz
libpng-1.6.12.tar.gz
libxml2-2.6.30.tar.gz
libxslt-1.1.22.tar.gz
php-5.5.14.tar.bz2
zlib-1.2.8.tar.gz
phpconfig:
'./configure' '--prefix=/usr/local/services/php' '--enable-fpm'
'--with-mysql=mysqlnd' '--with-mysqli=mysqlnd'
'--with-config-file-path=/usr/local/services/php/etc' '--with-gd'
'--enable-gd-native-ttf' '--enable-gd-jis-conv'
'--with-freetype-dir=/usr/local/services/plugin/freetype/'
'--with-jpeg-dir=/usr/local/services/plugin/jpeg/'
'--with-png-dir=/usr/local/services/plugin/libpng/'
'--with-zlib-dir=/usr/local/services/plugin/zlib/' '--enable-xml'
'--enable-mbstring' '--enable-soap'
'--with-libxml-dir=/usr/local/services/plugin/libxml/'
'--with-xsl=/usr/local/services/plugin/libxslt/'
'--with-curl=/usr/local/services/plugin/curl/'
'--with-mcrypt=/usr/local/services/plugin/libmcrypt/' '--enable-sysvsem'
'--enable-sysvshm' '--enable-sysvmsg'
'--with-iconv-dir=/usr/local/services/plugin/libiconv/' '--enable-sockets'
Previous Comments:
------------------------------------------------------------------------
[2007-10-11 01:00:00] 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".
------------------------------------------------------------------------
[2007-10-03 18:36:08] super at superduper dot org
Hey!
I'm sorry, i always found compiling the php module with all the dependencies a pain, which is
why I'm using Xampp.
I'm being pretty busy at the moment and don't have time for setting up the build
environment and testing it out. As I said - I got around the issue by using ini_set( ... ) with
mbstring compiled in on two different servers (with and without jis comiled into gd).
Maybe there is someone who test compiles php everyday that could try it out with the different
settings.
If you would like to have the code used for testing please let me know.
------------------------------------------------------------------------
[2007-10-03 09:22:33] pajoye@php.net
There is no fallback ot UTF-8. It accepts UTF-8 by default. The problem about JIS is when you pass a
non UTF-8 string, it can be seen as JIS enconded string.
About the mbstring issues, I have no idea how it works and how it affects the input parameters. It
is something happening before we got the hand in the gd function.
Please try using:
- Without mbstring, with jis enabled
- Without mbstring, without jis
It will help us (you and us) to figure out what break your config.
------------------------------------------------------------------------
[2007-10-02 23:33:41] super at superduper dot org
Hey!
I could fix the problem (on my host) by forcing an internal encoding.
ini_set( "mbstring.internal_encoding", "UTF-8" );
Is it possible that gd fails just because there is no default encoding set?
Can anyone verify this?
p.s.
So here's what i think is happening:
I have two machines (see my previous post), it works on one machine because the
mbstring.internal_encoding is not set and gd has no japenese support built in. Thus php and gd will
fall back to unicode.
On the other machine mbstring.internal_encoding isn't set either, but this time gd has japanese
support built in. As no encoding is set php falls back to unicode while gd falls back to japanese,
resulting in incompatible encodings. The rest is history.
Well... just some wild imaginations of someone who's never taken a look at the sourcecode...
------------------------------------------------------------------------
[2007-10-02 22:30:08] super at superduper dot org
Hello!
I'm in an interresting situation where I have to configurations - one in which the problem
occurs, one in which works perfectly fine.
I can't really tell the difference between the configurations, so i just post the most
important phpinfo() elements here and i hope it helps.
Both versions of php aren't recent. As it works in the older one (5.2.2) and doesn't in
the newer one i suspect it is more of a configuration issue.
---------- WORKING CONFIGURATION ---------
os x 10.4, xampp server, php 5.2.2
configure string:
'./configure' '--prefix=/Applications/xampp/xamppfiles'
'--program-suffix=-5.2.2' '--libdir=/Applications/xampp/xamppfiles/lib/php/php5'
'--includedir=/Applications/xampp/xamppfiles/include/php/php5'
'--with-apxs2=/Applications/xampp/xamppfiles/bin/apxs'
'--with-config-file-path=/Applications/xampp/etc'
'--with-mysql=/Applications/xampp/xamppfiles' '--disable-debug'
'--enable-bcmath' '--enable-calendar' '--enable-ctype'
'--enable-dbase' '--enable-discard-path' '--enable-exif'
'--enable-filepro' '--enable-force-cgi-redirect' '--enable-ftp'
'--enable-gd-imgstrttf' '--enable-gd-native-ttf' '--with-ttf'
'--enable-magic-quotes' '--enable-memory-limit' '--enable-safe-mode'
'--enable-shmop' '--enable-sigchild' '--enable-sysvsem'
'--enable-sysvshm' '--enable-track-vars' '--enable-trans-sid'
'--enable-wddx' '--enable-yp' '--with-ftp'
'--with-ncurses=/Applications/xampp/xamppfiles'
'--with-gdbm=/Applications/xampp/xamppfiles'
'--with-jpeg-dir=/Applications/xampp/xamppfiles' '--with-pn!
g-dir=/Applications/xampp/xamppfiles'
'--with-freetype-dir=/Applications/xampp/xamppfiles' '--without-xpm'
'--with-zlib=yes' '--with-zlib-dir=/Applications/xampp/xamppfiles'
'--with-openssl=/Applications/xampp/xamppfiles'
'--with-expat-dir=/Applications/xampp/xamppfiles'
'--enable-xslt=/Applications/xampp/xamppfiles'
'--with-xsl=/Applications/xampp/xamppfiles'
'--with-dom=/Applications/xampp/xamppfiles'
'--with-ldap=/Applications/xampp/xamppfiles' '--with-gd'
'--with-mysql-sock=/Applications/xampp/xamppfiles/var/mysql/mysql.sock'
'--with-mcrypt=/Applications/xampp/xamppfiles'
'--with-mhash=/Applications/xampp/xamppfiles' '--enable-sockets'
'--with-curl=/Applications/xampp/xamppfiles' '--enable-mbregex'
'--enable-zend-multibyte' '--with-zip=/Applications/xampp/xamppfiles'
'--enable-exif' '--with-sqlite'
'--with-libxml-dir=/Applications/xampp/xamppfiles' '--enable-soap'
'--enable-pcntl' '--enable-dbx'
'--with-mysqli=/Applications/xampp/xamppfiles/bin/mysql_config' '--with-bz2!
=/Applications/xampp/xamppfiles' '--with-ming=shared,/Applicat!
ions/xampp/xamppfiles' '--with-pear=/Applications/xampp/xamppfiles/lib/php/pear'
'--with-mssql=/Applications/xampp/xamppfiles'
'--with-imap-dir=/Applications/xampp/xamppfiles'
'--with-imap=/Applications/xampp/xamppfiles' '--enable-mbstring=all'
'--with-pgsql=shared,/usr' '--with-gettext=/Applications/xampp/xamppfiles'
mbstring config:
mbstring
Multibyte Support enabled
Multibyte string engine libmbfl
Multibyte (japanese) regex support enabled
Multibyte regex (oniguruma) version 4.4.4
Multibyte regex (oniguruma) backtrack check On
Directive Local Value Master Value
mbstring.detect_order no value no value
mbstring.encoding_translation Off Off
mbstring.func_overload 0 0
mbstring.http_input pass pass
mbstring.http_output pass pass
mbstring.internal_encoding no value no value
mbstring.language neutral neutral
mbstring.script_encoding no value no value
mbstring.strict_detection Off Off
mbstring.substitute_character no value no value
----------- BROKEN CONFIGURATION (my webhost)-------------
some linux, php 5.2.3
configure string:
Command './configure' '--with-apxs2=/usr/local/apache/bin/apxs'
'--prefix=/imports/php5' '--with-config-file-path=/imports/php5/'
'--with-openssl=/usr/local/ssl' '--with-dom' '--with-iconv'
'--with-curl' '--with-mysql=/usr/local' '--with-gettext'
'--enable-mbstring' '--with-xml' '--enable-track-vars'
'--enable-exif' '--with-jpeg-dir' '--with-zlib'
'--with-zlib-dir' '--with-png-dir' '--with-gd'
'--with-gettext' '--with-freetype-dir' '--with-xpm-dir'
'--enable-gd-native-ttf' '--enable-gd-jis-conv' '--with-mhash'
'--enable-ftp' '--with-pear' '--with-pspell'
'--with-mysqli=/usr/local/bin/mysql_config' '--with-ldap'
'--with-ldap-sasl' '--with-imap=../imap-2004g'
'--with-imap-ssl=/usr/local/ssl' '--with-libxml' '--with-xsl'
'--with-libexpat-dir=/usr' '--with-mcrypt' '--enable-bcmath'
'--with-mime-magic' '--enable-calendar' '--with-pdo-mysql'
'--enable-sockets' '--enable-soap' '--with-tidy'
mbstring
Multibyte Support enabled
Multibyte string engine libmbfl
Multibyte (japanese) regex support enabled
Multibyte regex (oniguruma) version 4.4.4
Multibyte regex (oniguruma) backtrack check On
Directive Local Value Master Value
mbstring.detect_order no value no value
mbstring.encoding_translation Off Off
mbstring.func_overload 0 0
mbstring.http_input pass pass
mbstring.http_output pass pass
mbstring.internal_encoding no value no value
mbstring.language neutral neutral
mbstring.strict_detection Off Off
mbstring.substitute_character no value no value
Conclusions?
To save you reading all that configurations - i realized only two differences:
- the working config was compiled with --enable-mbstring=all, the broken one only with
--enable-mbstring
- the working config's phpinfo shows mbstring.script_encoding set to no value, the broken
config (even though it's newer) doesn't list this option.
------------------------------------------------------------------------
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
https://bugs.php.net/bug.php?id=42218
--
Edit this bug report at https://bugs.php.net/bug.php?id=42218&edit=1