ID: 43596 Updated by: [EMAIL PROTECTED] Reported By: robin_fernandes at uk dot ibm dot com Status: Open Bug Type: Arrays related Operating System: Windows PHP Version: 5.3CVS-2007-12-14 (snap) New Comment:
Seeing the code, we note that is intentional, and according to documentation: "If it is omitted, then the sequence will have everything from offset up until the end of the array." Seems to be right. Previous Comments: ------------------------------------------------------------------------ [2007-12-14 18:59:45] [EMAIL PROTECTED] In PHP 5.3.0-dev (cli) (built: Dec 11 2007 13:57:26) returns: array(0) { } ------------------------------------------------------------------------ [2007-12-14 14:54:38] robin_fernandes at uk dot ibm dot com First line should read "With php5.2.x, explicitly specifying a $length argument of 0 would result in an array of length 0" - sorry. ------------------------------------------------------------------------ [2007-12-14 14:52:49] robin_fernandes at uk dot ibm dot com 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 this bug report at http://bugs.php.net/?id=43596&edit=1