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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: kyrmich at badfan dot coim
New email:
PHP Version: OS:

 

 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 14:01:35 2024 UTC