Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001233 [Quercus] minor always 07-05-06 20:16 07-17-06 19:26
Reporter koreth View Status public  
Assigned To ferg
Priority normal Resolution fixed  
Status closed   Product Version 3.0.20
Summary 0001233: each() doesn't populate class member variables in recursive methods
Description PHP code:

class Test {
        function doTest(& $foo) {
                list($this->key,) = each($foo);
                // The key should be empty after the first fetch
                if ($this->key)

$obj = new Test;
$foo = array();
$foo[1] = 'x';


Under regular PHP, this prints "1" and a blank line to standard error and terminates. Under Quercus, it keeps printing "1" and calling itself until it dies with a stack overflow exception.

Changing $this->key to just $key makes the problem go away. So does using a regular function (rather than a class method). So does making the method non-recursive and calling it twice from the main part of the code. However, using a member variable for the array rather than passing it as a parameter to the test method still exhibits the bug (so it's not, apparently, a bug in the parameter passing.)
Additional Information
Attached Files

- Relationships

- Notes
07-17-06 19:26


- Issue History
Date Modified Username Field Change
07-05-06 20:16 koreth New Issue
07-17-06 19:26 ferg Note Added: 0001404
07-17-06 19:26 ferg Assigned To  => ferg
07-17-06 19:26 ferg Status new => closed
07-17-06 19:26 ferg Resolution open => fixed
07-17-06 19:26 ferg Fixed in Version  => 3.0.20

Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
29 total queries executed.
26 unique queries executed.
Powered by Mantis Bugtracker