|
Mantis - Quercus
|
|||||
| Viewing Issue Advanced Details | |||||
|
|
|||||
| ID: | Category: | Severity: | Reproducibility: | Date Submitted: | Last Update: |
| 1233 | minor | always | 07-05-06 20:16 | 07-17-06 19:26 | |
|
|
|||||
| Reporter: | koreth | Platform: | |||
| Assigned To: | ferg | OS: | |||
| Priority: | normal | OS Version: | |||
| Status: | closed | Product Version: | 3.0.20 | ||
| Product Build: | Resolution: | fixed | |||
| Projection: | none | ||||
| ETA: | none | Fixed in Version: | 3.0.20 | ||
|
|
|||||
| 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: | |||||
| Relationships | |||||
| Attached Files: | |||||
| Notes | |||||
|
|
|||||
|
|
||||