#39356 [Opn->Bgs]: in_array() causes "Nesting level too deep" fatal error
| From: | iliaa@php.net | Date: | Fri, 03 Nov 2006 14:01:24 +0000 |
| Subject: | #39356 [Opn->Bgs]: in_array() causes "Nesting level too deep" fatal error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-104319@lists.php.net to get a copy of this message | ||
ID: 39356
Updated by: iliaa@php.net
Reported By: 7am dot online at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: Arrays related
Operating System: Windows XP
PHP Version: 5.2.0
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[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