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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: sergiy dot sf at gmail dot com
New email:
PHP Version: OS:

 

 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Fri Jul 05 15:01:29 2024 UTC