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:

I have tried with 5.2.5 and actual result is:
array(0) {
}



Previous Comments:
------------------------------------------------------------------------

[2007-12-15 07:36:47] robin_fernandes at uk dot ibm dot com

Hi Felipe, thanks for the update.
I understand and agree with the documented case in which the argument
is omitted. However, in the case described above, it is not omitted, but
rather explicitly provided as 0.

If this change in behaviour is intentional, I think the documentation
will need to be updated.

------------------------------------------------------------------------

[2007-12-14 21:46:28] [EMAIL PROTECTED]

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.

------------------------------------------------------------------------

[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

Reply via email to