From: xi dot wang at gmail dot com Operating system: PHP version: master-Git-2013-01-30 (Git) Package: Arrays related Bug Type: Bug Bug description:incorrect use of abs() in array_pad()
Description: ------------ Using `abs(pad_size) < 0' to catch the LONG_MIN case invokes undefined behavior in C. gcc simply assumes abs(pad_size) must be non-negative and discards the check. Test script: --------------- <?php // This is for 64-bit systems. $input = array(12, 10, 9); $input = array_pad($input, -9223372036854775808, 0); var_dump($input); ?> Expected result: ---------------- Warning: array_pad(): You may only pad up to 1048576 elements at a time in t.php on line 3 bool(false) Actual result: -------------- array(3) { [0]=> int(12) [1]=> int(10) [2]=> int(9) } -- Edit bug report at https://bugs.php.net/bug.php?id=64109&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=64109&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=64109&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=64109&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=64109&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=64109&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=64109&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=64109&r=needscript Try newer version: https://bugs.php.net/fix.php?id=64109&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=64109&r=support Expected behavior: https://bugs.php.net/fix.php?id=64109&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=64109&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=64109&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=64109&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64109&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=64109&r=dst IIS Stability: https://bugs.php.net/fix.php?id=64109&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=64109&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=64109&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=64109&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=64109&r=mysqlcfg