I'm trying to compare two objects with == and === and getting the following error message:

Fatal error: Nesting level too deep - recursive dependency?

The object has several child objects which hold a reference to the parent in them.

I want to check the reference in the child object to make sure that it is the correct parent object.

This is part of a sanity check for debugging purposes. Its quite easy to forget one & somewhere when dealing with the parent which causes a copy to be made. The child objects in the copy then no longer point to the parent that is active (the copy), but instead point to the original parent. This manifests itself in subtle errors revolving around the changes to the parent after the copy was made. I would like to detect this situation.

Is there a workaround for this object comparison which involves determining if two variables reference the same object?

Thanks.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to