ID:               39356
 Comment by:       ken at smallboxsoftware dot net
 Reported By:      7am dot online at gmail dot com
 Status:           Analyzed
 Bug Type:         Documentation problem
 Operating System: Windows XP
 PHP Version:      5.2.0
 New Comment:

I am experiencing this issue as well. Seems like a fairly large change
not to document. Also "==" can no longer be used to compare objects of
this configuration while "===" still can. Perhaps the functionality
behind "===" could be used in the in_array function when comparing
objects?


Previous Comments:
------------------------------------------------------------------------

[2006-11-04 14:47:26] [EMAIL PROTECTED]

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.

------------------------------------------------------------------------

[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

Reply via email to