php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35374 reset/next is broken
Submitted: 2005-11-24 22:31 UTC Modified: 2005-11-24 22:33 UTC
From: kyrmich at badfan dot coim Assigned:
Status: Not a bug Package: Arrays related
PHP Version: 4.4.1 OS: WIN XP / SP2
Private report: No CVE-ID: None
 [2005-11-24 22:31 UTC] kyrmich at badfan dot coim
Description:
------------
Broken reset/next functionality after upgrading from PHP 4.4.0 to 4.4.1 when the array is passed from the global scope.

The code below results in an infinite loop


Reproduce code:
---------------
<?
 
$Buffer["key1"] = "value1";

Process();

function Process() {
  global $Buffer;
  for (reset($Buffer); $key=key($Buffer); next($Buffer)) {
    print "processing key: $key\n";
  }
  print "done\n";
}

?>


Expected result:
----------------
processing key: key1
done

Actual result:
--------------
processing key: key1
.
. infinite loop
.
processing key: key1


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-11-24 22:33 UTC] tony2001@php.net
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. 

Thank you for your interest in PHP.

Fixed in CVS several weeks ago.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 04:01:38 2025 UTC