Bug #66797 [NEW]: mb_substr only takes 32-bit signed integer

From: Date: Fri, 28 Feb 2014 15:40:28 +0000
Subject: Bug #66797 [NEW]: mb_substr only takes 32-bit signed integer
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-184475@lists.php.net to get a copy of this message
From: astewart at online-buddies dot com Operating system: MacOS 10.9.2; CentOS 6.4 PHP version: 5.4.25 Package: mbstring related Bug Type: Bug Bug description:mb_substr only takes 32-bit signed integer Description: ------------ mb_substr takes an int argument for length, but does not accept all integers on a 64-bit compiled PHP. Instead, the number is treated as -(1<<31), and the string is therefore truncated to zero length. Test script: --------------- <?php assert('"1" == mb_substr("1", 0, PHP_INT_MAX)'); Expected result: ---------------- No output Actual result: -------------- PHP Warning: assert(): Assertion ""1" == mb_substr("1", 0, PHP_INT_MAX)" failed in t.php on line 2 PHP Stack trace: PHP 1. {main}() t.php:0 PHP 2. assert() t.php:2 -- Edit bug report at https://bugs.php.net/bug.php?id=66797&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=66797&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=66797&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=66797&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=66797&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=66797&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=66797&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=66797&r=needscript Try newer version: https://bugs.php.net/fix.php?id=66797&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=66797&r=support Expected behavior: https://bugs.php.net/fix.php?id=66797&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=66797&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=66797&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=66797&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66797&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=66797&r=dst IIS Stability: https://bugs.php.net/fix.php?id=66797&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=66797&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=66797&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=66797&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=66797&r=mysqlcfg

« previous php.bugs (#184475) next »