Bug #62171 [Com]: "Nesting level too deep - recursive dependency?" in case of ===
| From: | shiranai7 at hotmail dot com | Date: | Mon, 28 May 2012 15:56:06 +0000 |
| Subject: | Bug #62171 [Com]: "Nesting level too deep - recursive dependency?" in case of === | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-170873@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=62171&edit=1
ID: 62171
Comment by: shiranai7 at hotmail dot com
Reported by: ray dot burgemeestre at gmail dot com
Summary: "Nesting level too deep - recursive dependency?" in
case of ===
Status: Open
Type: Bug
Package: *Programming Data Structures
Operating System: linux
PHP Version: 5.4.3
Block user comment: N
Private report: N
New Comment:
I can confirm this on Windows. I also tried more cases:
For arrays: $a = array(); $a[0] = &$a;
For objects: $a = new stdClass; $a->b = &$a;
Results for comparisons of $a, $b
Type PHP Operator Result
---------------------------------------------
arrays 4.4.5 == fatal
arrays 4.4.5 === fatal
objects 4.4.5 == fatal
objects 4.4.5 === fatal
arrays 5.2.6 == fatal
arrays 5.2.6 === fatal
objects 5.2.6 == true
objects 5.2.6 === true
arrays 5.3.5 == fatal
arrays 5.3.5 === fatal
objects 5.3.5 == true
objects 5.3.5 === true
arrays 5.4.3 == fatal
arrays 5.4.3 === fatal
objects 5.4.3 == true
objects 5.4.3 === true
So this was fixed (either intentionally or along with general changes to object handling) in PHP 5
for objects but not for arrays.
Previous Comments:
------------------------------------------------------------------------
[2012-05-27 14:40:33] ray dot burgemeestre at gmail dot com
Description:
------------
Is it expected behaviour that === can trigger a Nesting level too deep error?
Test script:
---------------
<?php
$a = array(&$a);
$a === $a;
?>
Expected result:
----------------
I would expect $a === $a to return true.
Actual result:
--------------
$ php test.php
PHP Fatal error: Nesting level too deep - recursive dependency? in /srv/www/htdocs/test.php on line
3
Fatal error: Nesting level too deep - recursive dependency? in /srv/www/htdocs/test.php on line 3
$ php -v
PHP 5.4.3 (cli) (built: May 26 2012 22:29:08)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=62171&edit=1