From: frank at cleverbridge dot com Operating system: Linux 2.6.12-1.1381_FC3 #1 PHP version: 5.1.4 PHP Bug Type: Strings related Bug description: str_split not working in utf8 environment
Description: ------------ php.ini: ... mbstring.func_overload=6; mbstring.internal_encoding=UTF-8; mbstring.http_input = auto; mbstring.detect_order = ISO-8859-1,UTF-8; mbstring.encoding_translation = On; ... The function str_split does not work correctly with characters >1 byte. in my testscript the katakana character is submitted by a web form to php. in order to make the reproduce code as easy as possible i just copied the katakana symbol into the code. Reproduce code: --------------- $foo = '入'; print "StrLength: ".strlen($foo)."\n"; $I = str_split($foo); print "array size: ".sizeof($I)."\n"; print_r($I); Expected result: ---------------- StrLength: 1 array size: 1 Array ( [0] => 入; ) Actual result: -------------- StrLength: 1 array size: 3 Array ( [0] => � [1] => � [2] => � ) -- Edit bug report at http://bugs.php.net/?id=37661&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37661&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=37661&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37661&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=37661&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=37661&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=37661&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=37661&r=needscript Try newer version: http://bugs.php.net/fix.php?id=37661&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=37661&r=support Expected behavior: http://bugs.php.net/fix.php?id=37661&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=37661&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=37661&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=37661&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37661&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=37661&r=dst IIS Stability: http://bugs.php.net/fix.php?id=37661&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=37661&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=37661&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=37661&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=37661&r=mysqlcfg