#35835 [NEW]: next() does not work on referenced arrays

From: Date: Thu, 29 Dec 2005 03:39:35 +0000
Subject: #35835 [NEW]: next() does not work on referenced arrays
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-91201@lists.php.net to get a copy of this message
From:             ghetalion at ghetalion dot com
Operating system: Windows XP
PHP version:      4.4.1
PHP Bug Type:     Arrays related
Bug description:  next() does not work on referenced arrays

Description:
------------
When using next() on a referenced array, the internal pointer is not moved
at all.

Reproduce code:
---------------
function &getEach(&$a)
{
        if(($elem = current($a)) !== FALSE)
        {
                $k = key($a);
                next($a);
                return $a[$k];
        }
        return false;
} 

$alist = array("a", "b", "c");
for(reset($alist); $yup =& getEach($alist);)
{
 echo &yup;
}

Expected result:
----------------
abc

Actual result:
--------------
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(etc)

-- 
Edit bug report at http://bugs.php.net/?id=35835&edit=1
-- 
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=35835&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=35835&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=35835&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=35835&r=fixedcvs
Fixed in release:             http://bugs.php.net/fix.php?id=35835&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=35835&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=35835&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=35835&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=35835&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=35835&r=notwrong
Not enough info:              http://bugs.php.net/fix.php?id=35835&r=notenoughinfo
Submitted twice:              http://bugs.php.net/fix.php?id=35835&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=35835&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=35835&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=35835&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=35835&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=35835&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=35835&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=35835&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=35835&r=mysqlcfg


Thread (5 messages)

« previous php.bugs (#91201) next »