Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] 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 Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 3.0.20 Product Version 3.0.20
  Product Build
Summary 0001233: each() doesn't populate class member variables in recursive methods
Description PHP code:

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

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

$obj->doTest($foo);
?>

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.)
Steps To Reproduce
Additional Information
Attached Files

- Relationships

- Notes
(0001404)
ferg
07-17-06 19:26

php/03lb
 

- 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