View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0001296 | Xdebug | Uncategorized | public | 2016-04-26 11:22 | 2017-03-04 10:45 |
| Reporter | greew | Assigned To | |||
| Priority | high | Severity | major | Reproducibility | have not tried |
| Status | resolved | Resolution | no change required | ||
| Platform | Mac | OS | OS X El Capitan | OS Version | 10.11.4 (15E65) |
| Product Version | 2.4.0 | ||||
| Summary | 0001296: Using $this in __debugInfo() causes issues | ||||
| Description | When debugging with Xdebug 2.4.0 on PHP 7.0.5, 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' | ||||
| 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 | 13:17 $ 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);' Warning: Uncaught LogicException: The object is in an invalid state as the parent constructor was not called in Command line code:1 Call Stack: PHP Fatal error: __debuginfo() must return an array in Command line code on line 1 Fatal error: __debuginfo() must return an array in Command line code on line 1 Call Stack: ?-255 ~ | ||||
| Tags | No tags attached. | ||||
| Operating System | OS X | ||||
| PHP Version | 7.0.0-7.0.4 | ||||
|
|
I am not sure how this creates "infinite recursion", but I can reproduce your |
|
|
No, I thoughtlessly copied the title of the issue, that I also referenced in the title - but too late I remembered to change it. |
|
|
Just tried reproducing it again in PHP 7.0.6 and XDebug 2.5.0-dev - still an issue. 13:43 $ 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);' Warning: Uncaught LogicException: The object is in an invalid state as the parent constructor was not called in Command line code:1 Call Stack: PHP Fatal error: __debuginfo() must return an array in Command line code on line 1 Fatal error: __debuginfo() must return an array in Command line code on line 1 Call Stack: |
|
|
I can reproduce this issue still with PHP 7.0.13 and Xdebug 2.5.0RC2-dev. |
|
|
I tried this again, this time without Xdebug loaded (see the -n), and the result is exactly the same: derick@whisky:~/dev/php/derickr-xdebug $ cat tests/bug01296.phpt
} $a = new Foo( [ 1, 2, 3] ); Warning: Uncaught LogicException: The object is in an invalid state as the parent constructor was not called in /home/derick/dev/php/derickr-xdebug/tests/bug01296.phpt:17 Fatal error: __debuginfo() must return an array in /home/derick/dev/php/derickr-xdebug/tests/bug01296.phpt on line 22 So I fail to see why this is an Xdebug issue. Can you clarify please? |
|
|
Ping? |
|
|
Closing this as no additional feedback was provided, and the behaviour was the same without Xdebug loaded. |