ID: 42101 User updated by: mcorne at yahoo dot com Reported By: mcorne at yahoo dot com -Status: No Feedback +Status: Open Bug Type: mbstring related -Operating System: RedHat Linux x86-64 +Operating System: Linux x86-64 PHP Version: 5.2.3 New Comment:
Same issue on the latest release. Test done on: PHP Version => 5.2.4RC2-dev System => Linux durbatuluk 2.6.20-16-generic #2 SMP Thu Jun 7 19:00:28 UTC 2007 x86_64 Build Date => Aug 13 2007 21:59:11 Previous Comments: ------------------------------------------------------------------------ [2007-08-02 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-07-25 14:25:27] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php5.2-latest.tar.gz For Windows (zip): http://snaps.php.net/win32/php5.2-win32-latest.zip For Windows (installer): http://snaps.php.net/win32/php5.2-win32-installer-latest.msi ------------------------------------------------------------------------ [2007-07-25 12:10:28] mcorne at yahoo dot com Description: ------------ mb_substr("\x44\xCC\x87", 0, PHP_INT_MAX, 'UTF-8') only captures the first character on linux 64-bit instead of returning the whole string. Note that this works fine on Windows XP and Linux 32-bit. Reproduce code: --------------- function substring($string, $length) { $substr = mb_substr($string, 0, $length , 'UTF-8'); $length = strlen($substr); $chars = $length? unpack("C{$length}chars", $substr) : array(); $decs = array_map('dechex', $chars); return array($substr, $decs); } $test['string'] = "\x44\xCC\x87"; $test['utf8'] = '\x44\xCC\x87'; $test['unicode'] = '\u0044\u0307'; $test['PHP_INT_MAX'] = PHP_INT_MAX; $test['php_int_max'] = substring($test['string'], PHP_INT_MAX); $test['9999'] = substring($test['string'], 9999); print_r($test); Expected result: ---------------- Array ( [string] => Ḋ [utf8] => \x44\xCC\x87 [unicode] => \u0044\u0307 [PHP_INT_MAX] => 2147483647 [php_int_max] => Array ( [0] => Ḋ [1] => Array ( [chars1] => 44 [chars2] => cc [chars3] => 87 ) ) [9999] => Array ( [0] => Ḋ [1] => Array ( [chars1] => 44 [chars2] => cc [chars3] => 87 ) ) ) Actual result: -------------- Array ( [string] => Ḋ [utf8] => \x44\xCC\x87 [unicode] => \u0044\u0307 [PHP_INT_MAX] => 2147483647 [php_int_max] => Array ( [0] => D [1] => Array ( [chars1] => 44 ) ) [9999] => Array ( [0] => Ḋ [1] => Array ( [chars1] => 44 [chars2] => cc [chars3] => 87 ) ) ) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42101&edit=1