#23666 [Opn->Bgs]: array_pop() does not reset

From: Date: Fri, 16 May 2003 23:37:19 +0000
Subject: #23666 [Opn->Bgs]: array_pop() does not reset
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-39823@lists.php.net to get a copy of this message
 ID:               23666
 Updated by:       magnus@php.net
 Reported By:      goodie at apollointeractive dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Arrays related
 Operating System: All
 PHP Version:      4.3.1
 New Comment:

Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments
to the existing bug instead.

Thank you for your interest in PHP.

If you would read the NEWS file you would see that no 
other fixes except the security fix was added in 4.3.1.. 
This fix will be in 4.3.2. 


Previous Comments:
------------------------------------------------------------------------

[2003-05-16 16:56:33] goodie at apollointeractive dot com

I incorrectly stated that we are using version 4.3.2, we are using
4.3.1

------------------------------------------------------------------------

[2003-05-16 16:54:44] goodie at apollointeractive dot com

As stated in bug 21998 the functionality of array_pop has changed.  It
used to reset the array pointer, but stopped doing so in version 4.3.0.
 This behavior is still present in 4.3.1, causing anyone upgrading from
an older PHP version to have to add calls to reset() in code that makes
calls to array_pop().  As a result of bug 21998 the documentation was
updated to state that array_pop() resets the pointer, but it appears
that the source code was not altered to make this happen.  The
functionality should be changed to reset the pointer so that it is
consistent with both the documentation and previous versions of PHP. 
This could be present in other functions that operate on arrays, such
as array_shift().  

Example
<?php
$states = array ("CA"=> "California",
"NV" => "Nevada",
"NM" => "New Mexico");
array_pop($states);
while (list($key,$val) = each($states)){
echo "$key = $val\n";
}
?>
expected output is:
CA = California
NV = Nevada

Actual output is blank, due to pointer not being reset.  

We are running a debug build of 4.3.2 on FreeBSD.
'./configure' '--with-mssql=/www/lib/freetds-0.61'
'--with-mysql=/www/mysql' '--with-apache=../apache_1.3.27.php.debug'
'--enable-track-vars' '--enable-calendar' '--enable-ftp'
'--enable-trans-sid' '--prefix=/www' '--with-zlib'
'--enable-debug' 

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=23666&edit=1



Thread (3 messages)

« previous php.bugs (#39823) next »