#27782 [Opn->Csd]: Wrong behaviour of next() and prev()
| From: | iliaa@php.net | Date: | Tue, 30 Mar 2004 19:00:24 +0000 |
| Subject: | #27782 [Opn->Csd]: Wrong behaviour of next() and prev() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-57150@lists.php.net to get a copy of this message | ||
ID: 27782
Updated by: iliaa@php.net
Reported By: giovanni at giacobbi dot net
-Status: Open
+Status: Closed
Bug Type: Scripting Engine problem
Operating System: Linux
PHP Version: 4.3.4
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[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