View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001166 | Xdebug | Uncategorized | public | 2015-06-22 21:13 | 2015-11-05 15:13 |
Reporter | plankmeister | Assigned To | derick | ||
Priority | high | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Fixed in Version | 2.4.0beta1 | ||||
Summary | 0001166: Using $this in __debugInfo() causes infinite recursion (Doesn't appear to be the same as issue #00001140) | ||||
Description | When debugging with Xdebug 2.3.3 on PHP 5.6.9, stepping into an object that has a defined __debugInfo() method that refers to $this causes an uncaught LogicException; 'The object is in an invalid state as the parent constructor was not called' When single-stepping, the moment the first expression in the constructor is stepped into, execution skips to the __debugInfo() method, where it dies upon encountering $this. | ||||
Steps To Reproduce | php -dxdebug.auto_trace=1 -dxdebug.collect_params=3 -r 'class Foo extends IteratorIterator{function __construct($items){if(is_array($items)){$items=new ArrayIterator($items);}}function __debugInfo(){return ["count"=>iterator_count($this)];}};$a=new Foo([1,2,3]);var_dump($a);' | ||||
Additional Information | Output extract: PHP Stack trace: PHP 1. {main}() Command line code:0 PHP Warning: Uncaught exception 'LogicException' with message 'The object is in an invalid state as the parent constructor was not called' in Command line code:1 Stack trace: #0 [internal function]: IteratorIterator->rewind() #1 Command line code(1): iterator_count(Object(Foo)) 0000002 [internal function]: Foo->__debugInfo() 0000003 [internal function]: IteratorIterator->rewind() 0000004 Command line code(1): iterator_count(Object(Foo)) 0000005 [internal function]: Foo->__debugInfo() 0000006 [internal function]: IteratorIterator->rewind() 0000007 Command line code(1): iterator_count(Object(Foo)) 0000008 [internal function]: Foo->__debugInfo() 0000009 [internal function]: IteratorIterator->rewind() 0000010 Command line code(1): iterator_count(Object(Foo)) 0000011 [internal function]: Foo->__debugInfo() 0000012 [internal function]: IteratorIterator->rewind() 0000013 Command line code(1): iterator_count(Object(Foo)) 0000014 [internal function]: Foo->__debugInfo() 0000015 [internal function]: IteratorIterator->rewind() 0000016 Command line code(1): iterator_count(Object(Foo)) 0000017 [internal fu in Command line code on line 1 | ||||
Tags | No tags attached. | ||||
Operating System | Debian GNU/Linux 7.8 (wheezy) | ||||
PHP Version | 5.5.15-5.5.19 | ||||
|
The actual Class in production code that produces the issue is https://github.com/cakephp/cakephp/blob/3.1/src/Collection/Collection.php if the context is important. |
|
Thanks - I can reproduce this with your reproduce script. Thanks for making it so short! I'll have a look. |
|
Fixed for 2.3.4 and 3.0dev |
Date Modified | Username | Field | Change |
---|---|---|---|
2015-06-22 21:13 | plankmeister | New Issue | |
2015-06-22 21:16 | plankmeister | Note Added: 0003127 | |
2015-06-25 13:43 | derick | Note Added: 0003138 | |
2015-06-28 15:11 | derick | Note Added: 0003142 | |
2015-06-28 15:11 | derick | Status | new => closed |
2015-06-28 15:11 | derick | Assigned To | => derick |
2015-06-28 15:11 | derick | Resolution | open => fixed |
2015-06-28 15:11 | derick | Fixed in Version | => 2.3.4 |
2015-11-05 15:08 | derick | Fixed in Version | 2.3.4 => 2.4.0beta1 |
2015-11-05 15:13 | derick | Category | Debug client (console) => Usage problems |
2016-07-31 12:36 | derick | Category | Usage problems => Usage problems (Crashes) |
2016-07-31 12:38 | derick | Category | Usage problems (Crashes) => Usage problems (Wrong Results) |
2020-03-12 16:35 | derick | Category | Usage problems (Wrong Results) => Variable Display |
2020-03-12 16:38 | derick | Category | Variable Display => Uncategorized |