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

From: Date: Tue, 29 Jan 2008 00:40:53 +0000
Subject: #43596 [Opn->Csd]: 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-121680@lists.php.net to get a copy of this message
ID: 43596 Updated by: tony2001@php.net Reported By: robin_fernandes at uk dot ibm dot com -Status: Open +Status: Closed Bug Type: Arrays related Operating System: Windows PHP Version: 5.3CVS-2007-12-14 (snap) New Comment: Fixed in CVS. Please change the test accordingly. It would be also really good if you divide that ENORMOUS test to a bunch of small (1000 linex max) tests. Previous Comments: ------------------------------------------------------------------------ [2008-01-26 17:45:07] robin_fernandes at uk dot ibm dot com 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. ------------------------------------------------------------------------ [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) { } ------------------------------------------------------------------------ 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 (#121680) next »