ID:               39356
 Updated by:       [EMAIL PROTECTED]
 Reported By:      7am dot online at gmail dot com
-Status:           Analyzed
+Status:           Closed
-Bug Type:         Documentation problem
+Bug Type:         Arrays related
 Operating System: Windows XP
 PHP Version:      5.2.0


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

[2007-06-15 05:35:31] judas dot iscariote at gmail dot com

This behaviour has been corrected in current 5_2 CVS, if now first try
with  === on objects and then with "==" effectively helping to avoid the
recursive dependency in **some** cases like the test case of the
reporter.

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

[2006-11-23 18:24:01] ken at smallboxsoftware dot net

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?

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

[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