From: php at diptyque dot net Operating system: FreeBSD 4.4 PHP version: 4.4.4 PHP Bug Type: mbstring related Bug description: Changing internal character encoding affects function overloading
Description: ------------ Changing internal character encoding during script execution apparently affects mbstring function overloading: strlen() returns the length of the string based on current internal encoding although function overloading is disabled (either through php.ini, vhost and/or .htaccess settings.) On apache 1.3 startup or graceful restart, script may run as expected but repeated requests would inevitably trigger the bug -- on my server setup, MediaWiki cannot run reliably because of this weird behavior :-/ The bug is not triggered when I do run this script under other SAPIs such as CLI or FastCGI. ./configure --with-apxs=/usr/local/apache/bin/apxs --with-mysql=/usr/local --with-openssl=/usr/local/apache --with-gd=/usr/local --with-zlib --with-bz2 --with-xml --with-freetype-dir=/usr/local --with-ttf --with-imap --with-curl --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-readline=/usr/local --prefix=/usr/local/apache --with-config-file-path=/usr/local/apache/etc --enable-mbstring --enable-mbregex --enable-zend-multibyte ; configure line Reproduce code: --------------- http://www.diptyque.net/bugs/mbinfo.php ; running PHP 4.4 as an apache module ; display charset is set to UTF-8 ; when internal encoding is set to UTF-8, ; strlen() returns the wrong character count ; (e.g. 18 instead of 19) http://www.diptyque.net/bugs/mbinfo.phps ; source code Expected result: ---------------- string(10) "ISO-8859-1" string(10) "ISO-8859-1" string(1) "0" string(19) "Méthodes de codage" int(19) -- bool(true) string(5) "UTF-8" string(10) "ISO-8859-1" string(1) "0" string(19) "Méthodes de codage" int(18) -- bool(true) string(10) "ISO-8859-1" string(10) "ISO-8859-1" string(1) "0" string(19) "Méthodes de codage" Actual result: -------------- string(10) "ISO-8859-1" string(10) "ISO-8859-1" string(1) "0" string(19) "Méthodes de codage" int(19) -- bool(true) string(5) "UTF-8" string(10) "ISO-8859-1" string(1) "0" string(19) "Méthodes de codage" int(19) -- bool(true) string(10) "ISO-8859-1" string(10) "ISO-8859-1" string(1) "0" string(19) "Méthodes de codage" -- Edit bug report at http://bugs.php.net/?id=38577&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=38577&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=38577&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=38577&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=38577&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=38577&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=38577&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=38577&r=needscript Try newer version: http://bugs.php.net/fix.php?id=38577&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=38577&r=support Expected behavior: http://bugs.php.net/fix.php?id=38577&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=38577&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=38577&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=38577&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38577&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=38577&r=dst IIS Stability: http://bugs.php.net/fix.php?id=38577&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=38577&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=38577&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=38577&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=38577&r=mysqlcfg