Edit report at https://bugs.php.net/bug.php?id=51533&edit=1
ID: 51533
Comment by: herb at bobbingwide dot com
Reported by: neel dot basu dot z at gmail dot com
Summary: [recursive reference In Array] Nesting level too
deep
Status: Open
Type: Bug
Package: Scripting Engine problem
Operating System: Linux
PHP Version: 5.3.2
Block user comment: N
Private report: N
New Comment:
There is a comment in http://us.php.net/manual/en/function.is-array.php#98156
which suggests using casting to array to check if an array is actually an
array. I was
using this solution within a function that returns a default if the array index
is not
defined. It worked quite nicely until I tried to apply it to $GLOBALS and I
got the
Nesting level too deep.
So I'm looking for another, highly efficient, solution that won't issue php
notices for
undefined indexes.
Test script:
<?php $GLOBALS == $GLOBALS;
Expected result:
Actual result:
Fatal error: Nesting level too deep - recursive dependency?
Previous Comments:
------------------------------------------------------------------------
[2011-07-02 00:36:43] trefighter2334 at aol dot com
Any word on this? I'm also experiencing this bug in both Ubuntu (Zend Server
AND
vanilla PHP) and Windows 7 (Zend Server).
I guess I'm off to go find some hackish way to detect array recursion.
------------------------------------------------------------------------
[2010-04-11 19:38:45] neel dot basu dot z at gmail dot com
**If It is not a Bug then Recursive Reference Detection is IMPOSSIBLE in PHP.
cause spl_object_hash() doesn't work on array or scaler types.
------------------------------------------------------------------------
[2010-04-11 19:35:59] neel dot basu dot z at gmail dot com
Description:
------------
When there is recursive reference in an array comparison yields Fatal Error.
Both == and === operators yields the same.
//-------
If It is not a Bug then Recursion Detection is IMPOSSIBLE in PHP.
cause spl_object_hash() doesn't work on array or scaler types.
Test script:
---------------
<?php
error_reporting(255);
ini_set('display_errors','On');
header('Content-Type: text/plain');
$a = array();
$a[0] = &$a;
var_dump($a === $a[0]);
var_dump($a == $a[0]);
?>
Expected result:
----------------
boolean true or false
Actual result:
--------------
Fatal error: Nesting level too deep - recursive dependency? in
/Server/http/php-bugs/nesting.php on line 8
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=51533&edit=1