PHP Classes

PHP 5.2* Nesting level too deep - recursive dependency?

Recommend this page to a friend!

      Adv XML to Array  >  All threads  >  PHP 5.2* Nesting level too deep -...  >  (Un) Subscribe thread alerts  
Subject:PHP 5.2* Nesting level too deep -...
Summary:There is a change in php which affects ~line 62 in xml2array
Messages:2
Author:Shawn Pritchard
Date:2007-07-06 19:12:45
Update:2009-01-09 14:48:10
 

  1. PHP 5.2* Nesting level too deep -...   Reply   Report abuse  
Picture of Shawn Pritchard Shawn Pritchard - 2007-07-06 19:12:45
We just upgraded from PHP 5.1.6 and spent about 12 hours trying to find the cause of this error.

I happened to find an answer on google which stated:

**************************
Basically, his problem was using the "non-strict" evaluation for checking if two objects were equal to each other (== instead of ===). This compares everything about them, down to the properties - even if they're references to other properties inside of the same class (which is where the problem lies).

So, the fix is simple - === instead of == when comparing those objects. You'll be happier for the change.
**************************

So on line 62 of class.xml2array.php I changed this:

if ($child->node_name() == $testnode->node_name() && $child != $testnode)

to THIS:

if ($child->node_name() === $testnode->node_name() && $child !== $testnode)

Now all is well again!

I hope this helps somebody out! :-)

  2. Re: PHP 5.2* Nesting level too deep -...   Reply   Report abuse  
Picture of Bastian Gorke Bastian Gorke - 2009-01-09 14:48:11 - In reply to message 1 from Shawn Pritchard
Thanks... better late than never, i changed this in the source as well.