From:             tokul at users dot sourceforge dot net
Operating system: Linux Debian Sarge
PHP version:      4.4.1
PHP Bug Type:     Arrays related
Bug description:  next() does not work with global variable

Description:
------------
next() does not advance the internal array pointer, if it is run on global
variable inside function.

Reproduce code:
---------------
global $test;
$test=array(1=>'one',2=>'two',3=>'three');
function test() {
  global $test;
  echo current($test)."\n";
  next($test);
  echo current($test)."\n";
  next($test);
  echo current($test)."\n";
}
test();

Expected result:
----------------
one
two
three

Actual result:
--------------
one
one
one

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

Reply via email to