Dump does not have a recursion limit
When dumping this sort of a structure, Dump breaks.
$v = 'Hi';
for ($i = 0; $i < 50; $i ++) {
$v = array($v);
}
Dump::out($v, 'Deeeeeeeeep');
It's actually worse with nested objects - we can't go as deep due to calls to dumpAnything -> dumpObject -> objectstdClass.
Perhaps FirePHP can offer a suggested way to handle this. (see the "encodeObject" method). https://github.com/firephp/firephp-core/blob/master/lib/FirePHPCore/FirePHP.class.php#L1301
Holding objects during processing could have some performance impacts; however, since this is a development tool only, I don't forsee it being a significant concern.
What about not using recursion? You should be able to flatten the structure and while loop until you've navigated the structure. Might run into memory concerns detecting recursion, but that's already a concern I believe.
I believe that there are two problems here. First, we use recursion and so we hit PHP's recursion limit. Secondly, there's no way of stopping Dump from reporting the whole object. I might only care about the first couple of levels.
Maybe the structure of Dump's call should change?
Dump::someDifferentMethod($content, $depth);
The purpose of dump is to peer into the data in a variable. Choosing a reasonable depth IMHO is really in the eye of the caller. Perhaps if someone is blindly calling the method, they're using the tool incorrectly.
For example,
lets assume dump's default recursion limit is 2, and the method signature is
public function method($something, $depth = 2).
Johnny Developer needs to access a piece of data contained in his variable...
Dump::method($user)
(object) Person::__setState(array(
'siblings' => array(
'Gina' => (object) Person::__setState(array(
'siblings' => array(
'Johnny' => (object) Person::__setState(array(
'siblings' => array(
'Gina' => (*** recursion ***)
),
),
),
)),
),
));
The side effect here, is that you don't get clean output that can be simply cut-and-paste for use. (As is sometimes useful with Dump)