ID: 39356 Updated by: [EMAIL PROTECTED] Reported By: 7am dot online at gmail dot com -Status: Bogus +Status: Open Bug Type: Arrays related Operating System: Windows XP PHP Version: 5.2.0 New Comment:
http://php.net/in_array is completely quiet about references this is a change from 5.1 so it should at least be a documentation problem. Previous Comments: ------------------------------------------------------------------------ [2006-11-03 14:01:24] [EMAIL PROTECTED] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php In php 5 objects are passed by reference, so your code does in fact create a circular dependency. ------------------------------------------------------------------------ [2006-11-03 03:04:24] 7am dot online at gmail dot com Description: ------------ Doing a in_array() check against an array containing objects with recursive dependency causes a "Nesting level too deep - recursive dependency?" fatal error. Reproduce code: --------------- <?php class A { public $b; } class B { public $a; } $a = new A; $b = new B; $b->a = $a; $a->b = $b; $test = array($a, $b); var_dump(in_array($a, $test)); Expected result: ---------------- bool(true), as in PHP5.1.6 Actual result: -------------- Fatal error: Nesting level too deep - recursive dependency? in [FILENAME] on line 19 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=39356&edit=1