#27782 [Csd]: Wrong behaviour of next() and prev()
| From: | giovanni at giacobbi dot net | Date: | Tue, 30 Mar 2004 20:11:40 +0000 |
| Subject: | #27782 [Csd]: Wrong behaviour of next() and prev() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-57155@lists.php.net to get a copy of this message | ||
ID: 27782
User updated by: giovanni at giacobbi dot net
Reported By: giovanni at giacobbi dot net
Status: Closed
Bug Type: Scripting Engine problem
Operating System: Linux
PHP Version: 4.3.4
New Comment:
the following revision:
+++ ext/standard/array.c 30 Mar 2004 19:09:10 -0000
1.199.2.31
has been tested and perfectly works.
Thank you.
Previous Comments:
------------------------------------------------------------------------
[2004-03-30 14:00:23] iliaa@php.net
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
------------------------------------------------------------------------
[2004-03-30 12:09:37] giovanni at giacobbi dot net
Description:
------------
As stated in documentation, next() returns the NEXT element in the
array and THEN increases internal pointer. Thus, when this function
returns FALSE, I expect the internal pointer to be in the last
position, thus prev() should return end()-1 element.
Reproduce code:
---------------
<?php
$a = array("a", "b", "c");
reset($a);
while (next($a) !== FALSE);
var_dump(prev($a));
Expected result:
----------------
string(1) "b"
Actual result:
--------------
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=27782&edit=1