Open leeoniya opened 9 years ago
hey, quick question, do you take into consideration that while the reference to the object might be the same, the object itself might have changed between displayed positions - especially when displaying trace, but not only then..?
no, i do not.
that is a valid point though. definitely something that would require recursion to be detected differently than simply 're-dumping', as is done now.
i'm going to push a one-liner fix for this by clearing Type::$dic
entirely @ https://github.com/leeoniya/dump_r.php/blob/master/src/dump_r/Core.php#L17. this way there will not be cross-dump referencing. thanks for the note.
the irony here being that i actually reset it manually in the test/example file in 3 places [1],[2],[3] to prevent cross-dump refs from screwing up multiple dumps of the same object. while not specifically the situation you pointed out, this fix will help that, too.
[1] https://github.com/leeoniya/dump_r.php/blob/master/test/index.php#L26 [2] https://github.com/leeoniya/dump_r.php/blob/master/test/index.php#L32 [3] https://github.com/leeoniya/dump_r.php/blob/master/test/index.php#L39
the following will now work as expected:
$obj = new stdClass;
$obj->self = &$obj;
dump_r($obj);
$obj->x = 'sss';
dump_r($obj);
array, object and closure references
[*]
,{*}
,(*)
should be unfoldable via DOMcloneNode