php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35729 infinite loop in php-4.4.1
Submitted: 2005-12-19 00:28 UTC Modified: 2005-12-19 00:47 UTC
From: sergiy dot sf at gmail dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.4.1 OS: FreeBSD 5.4-RELEASE
Private report: No CVE-ID: None
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
42 + 22 = ?
Subscribe to this entry?

 
 [2005-12-19 00:28 UTC] sergiy dot sf at gmail dot com
Description:
------------
PHP 4.4.1 drops into an infinite loop 
(lots of '1 => one' gets printed). This 
problem doesn't exist in PHP 5.1.1 and 
in PHP version prior 4.4.1.

Reproduce code:
---------------
<?php

$a = array('1'=>'one','2'=>'two','3'=>'three');

function test(){
    global $a;
	for( reset($a); $key = key($a); next($a)) {
		echo "$key => $a[$key]\n";
	}
}
test();
?>

Expected result:
----------------
1 => one
2 => two
3 => three

Actual result:
--------------
1 => one
1 => one
1 => one
1 => one
1 => one
1 => one
1 => one
1 => one
1 => one
1 => one
1 => one
1 => one
1 => one
...




Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-12-19 00:34 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.

We had about 10 reports about it before.
 [2005-12-19 00:47 UTC] sergiy dot sf at gmail dot com
sorry to trouble you
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 10:01:33 2025 UTC