From: robin_fernandes at uk dot ibm dot com Operating system: Windows PHP version: 5.3CVS-2007-12-14 (snap) PHP Bug Type: Arrays related Bug description: array_slice(): $length arg ignored when it is 0 (unlike in php5.2.5)
Description: ------------ With php5.2.x, explicitly specifying an argument of length 0 would result in an array of length 0. However, with the snaps for php5.3 and php6.0, the length argument is ignored if it is 0. This may have been introduced by the patch for bug 43541, which fixed the type conversion for this parameter. Note that testcase ext/standard/tests/array/array_slice.phpt is affected by this change. Expected output below is taken from php5.2.5. Reproduce code: --------------- <?php $a = array(1,2,3,4); var_dump(array_slice($a, 1, 0)); ?> Expected result: ---------------- array(0) { } Actual result: -------------- array(3) { [0]=> int(2) [1]=> int(3) [2]=> int(4) } -- Edit bug report at http://bugs.php.net/?id=43596&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43596&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43596&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43596&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43596&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=43596&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=43596&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=43596&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=43596&r=needscript Try newer version: http://bugs.php.net/fix.php?id=43596&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=43596&r=support Expected behavior: http://bugs.php.net/fix.php?id=43596&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=43596&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=43596&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=43596&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43596&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=43596&r=dst IIS Stability: http://bugs.php.net/fix.php?id=43596&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=43596&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=43596&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=43596&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=43596&r=mysqlcfg