Anonymous | Login | Signup for a new account | 12-17-2024 10:52 PST |
Main | My View | View Issues | Change Log | Docs |
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: <?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.) |
||||||||
Additional Information | |||||||||
Attached Files | |||||||||
|
Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
29 total queries executed. 26 unique queries executed. |