#21998 [NEW]: array_pop() moves current element pointer since 4.3.0
| From: | php at alterego dot dp dot ua | Date: | Sat, 01 Feb 2003 19:42:12 +0000 |
| Subject: | #21998 [NEW]: array_pop() moves current element pointer since 4.3.0 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-31844@lists.php.net to get a copy of this message | ||
From: php@alterego.dp.ua
Operating system: all
PHP version: 4.3.0
PHP Bug Type: Scripting Engine problem
Bug description: array_pop() moves current element pointer since 4.3.0
<?
$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 bug report at http://bugs.php.net/?id=21998&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=21998&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=21998&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=21998&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=21998&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=21998&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=21998&r=support
Expected behavior: http://bugs.php.net/fix.php?id=21998&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=21998&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=21998&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=21998&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21998&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=21998&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=21998&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=21998&r=gnused