ID: 50739 Updated by: j...@php.net Reported By: zhalassy at loginet dot hu -Status: Open +Status: Bogus Bug Type: Arrays related Operating System: Irrelevant PHP Version: 5.2.12 New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. Previous Comments: ------------------------------------------------------------------------ [2010-01-13 12:49:42] zhalassy at loginet dot hu Description: ------------ At the moment, you can't do things like: $GLOBALS === $GLOBALS; or $a = array('a' => &$a); $a === $a['a']; both causes fatal error claiming too deep nesting level. I find it rather strange that you can use references, but you can't test if something is referencing the same thing or not... It would be nice to have some ==== or is_same(&$a,&$b) function which would just do a lookup in the symbol table and if the two variables referencing the same thing it would return true, false otherwise. Reproduce code: --------------- $a = is_same($GLOBALS,$GLOBALS); $x = array('x' => &$x); $b = is_same($x, $x['x']); $x1 = array('c' => &$x1); $x2 = array('c' => &$x2); //same layout, but not the same variable; $c = is_same($x1,$x2); $y1 = "test"; $y2 = $y1; /* plain assignement, maybe same till y1 or y2 not changed, but is_same() shouldn't get affected by optimization behaviour */ $d = is_same($y1,$y2); $z1 = "test2"; $z2 = &$z1; //or $z2 =& $z1; $e = is_same($z1,$z2); Expected result: ---------------- $a === true; $b === true; $c === false; $d === false; $e === true; Actual result: -------------- No way to do this ATM (AFAIK). But please tell me if i didn't read the documentation properly... ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50739&edit=1