#21998 [Opn->Ana]: array_pop() moves current element pointer since 4.3.0
| From: | magnus@php.net | Date: | Sat, 01 Feb 2003 21:08:58 +0000 |
| Subject: | #21998 [Opn->Ana]: array_pop() moves current element pointer since 4.3.0 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-31850@lists.php.net to get a copy of this message | ||
ID: 21998
Updated by: magnus@php.net
Reported By: php@alterego.dp.ua
-Status: Open
+Status: Analyzed
-Bug Type: Scripting Engine problem
+Bug Type: Arrays related
Operating System: all
PHP Version: 4.3.0
-Assigned To:
+Assigned To: sniper
New Comment:
Array related.
One of these commits broke it.
revision 1.180
date: 2002/08/01 17:34:31; author: rodif_bl; state: Exp;
lines: +12 -15
array_pop wasnt setting next index
----------------------------
revision 1.179
date: 2002/08/01 16:44:47; author: sniper; state: Exp;
lines: +1 -4
That was not correct..
----------------------------
revision 1.178
date: 2002/08/01 16:39:52; author: sniper; state: Exp;
lines: +5 -2
Reset index when doing array_pop()
Previous Comments:
------------------------------------------------------------------------
[2003-02-01 13:42:12] php@alterego.dp.ua
<?
$a = array("a", "b", "c");
each($a);
array_pop($a);
var_dump(each($a));
?>
This prints "bool(false)" in 4.3.0 (current element pointer points
somewhere out of the array) and var_dump($a[0]) in 4.2.3 (array is
reset after array_pop).
I had to add many additional reset()'s after installing 4.3.0.
How array_pop() (and may be others) affects current element pointer is
not documented, so this behavior is not a bug. The only purpose of
writing all this is that I want to know how array_pop() will work in
future PHP releases.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=21998&edit=1