ZF-11385: Zend_Json doesn't seem to count recursion correctly
Description
The following XML fragment has a nested depth of 6. It however throws a maxRecursion error ($maxRecursionDepthAllowed is set to 25). If I remove any one of the nodes below, it translates perfectly. So it is counting across nodes as well.
$body = <<success200 OKABCDEFGHABCDEABCDEABCABCD0.0790269374847
EOF;
header('Content-type', 'text/json');
echo Zend_Json::fromXml($body, true);
If I add these lines in _processXml to see what's going on:
Zend_Debug::dump($recursionDepth);
Zend_Debug::dump($simpleXmlElementObject);
... I find that it is counting every node laterally rather than by depth.
Comments
Posted by Adam Lundrigan (adamlundrigan) on 2011-08-26T21:25:43.000+0000
I was able to reproduce your issue against SVN tag release-1.11.6 using the XML you provided, but not against trunk. It appears that this issue was eliminated in 1.11.7 with the fix for ZF-3257 (fromXml functionality was rewritten).
Here are my tests, both of which pass:
Posted by Adam Lundrigan (adamlundrigan) on 2011-08-26T21:55:32.000+0000
Committed tests in r24406 Merged to release-1.11 in r24407
Posted by Adam Lundrigan (adamlundrigan) on 2011-08-26T23:17:55.000+0000
Just realized that when I slimmed-down the XML, it kinda defeated the purpose of the tests. I've made it right. Merged updated tests to trunk in r24409 and release-1.11 in r24410
Posted by Adam Lundrigan (adamlundrigan) on 2011-08-26T23:37:47.000+0000
Issued ZF2 pull request PR-356 to have changes pulled forward