MantisBT

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001166XdebugUsage problems (Wrong Results)public2015-06-22 22:132015-11-05 15:13
Reporterplankmeister 
Assigned Toderick 
PriorityhighSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version2.4.0beta1 
Summary0001166: Using $this in __debugInfo() causes infinite recursion (Doesn't appear to be the same as issue 0001140)
DescriptionWhen 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 Reproducephp -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 InformationOutput 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
TagsNo tags attached.
Operating SystemDebian GNU/Linux 7.8 (wheezy)
PHP Version5.5.15-5.5.19
Attached Files

- Relationships

-  Notes
(0003127)
plankmeister (reporter)
2015-06-22 22:16

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.
(0003138)
derick (administrator)
2015-06-25 14:43

Thanks - I can reproduce this with your reproduce script. Thanks for making it so short! I'll have a look.
(0003142)
derick (administrator)
2015-06-28 16:11

Fixed for 2.3.4 and 3.0dev

- Issue History
Date Modified Username Field Change
2015-06-22 22:13 plankmeister New Issue
2015-06-22 22:16 plankmeister Note Added: 0003127
2015-06-25 14:43 derick Note Added: 0003138
2015-06-28 16:11 derick Note Added: 0003142
2015-06-28 16:11 derick Status new => closed
2015-06-28 16:11 derick Assigned To => derick
2015-06-28 16:11 derick Resolution open => fixed
2015-06-28 16: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 13:36 derick Category Usage problems => Usage problems (Crashes)
2016-07-31 13:38 derick Category Usage problems (Crashes) => Usage problems (Wrong Results)


Copyright © 2000 - 2017 MantisBT Team
Powered by Mantis Bugtracker