#43596 [Opn]: array_slice(): $length arg ignored when it is 0 (unlike in php5.2.5)

From: Date: Sat, 26 Jan 2008 17:45:12 +0000
Subject: #43596 [Opn]: array_slice(): $length arg ignored when it is 0 (unlike in php5.2.5)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-121576@lists.php.net to get a copy of this message
ID: 43596 User updated by: robin_fernandes at uk dot ibm dot com 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: Hi msaraujo, thanks for looking at this. Just to ensure there is no confusion: the purpose of this report is to notify of a change in behaviour at least in the php 5.3 / 6.0 snaps. We agree that php 5.2.5 outputs array(0) { }, and I believe that is the correct output. Previous Comments: ------------------------------------------------------------------------ [2008-01-25 20:16:48] msaraujo@php.net I have tried with 5.2.5 and actual result is: array(0) { } ------------------------------------------------------------------------ [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] felipe@php.net 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] felipe@php.net 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. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/43596 -- Edit this bug report at http://bugs.php.net/?id=43596&edit=1

« previous php.bugs (#121576) next »