#48121 [Opn->Bgs]: Reference inconsistency

From: Date: Thu, 30 Apr 2009 15:16:43 +0000
Subject: #48121 [Opn->Bgs]: Reference inconsistency
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-136579@lists.php.net to get a copy of this message
ID: 48121 Updated by: jani@php.net Reported By: feldkamp at gameforge dot de -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: Debian Etch 2.6.26 PHP Version: 5.2.9 New Comment: 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 $a =& $foo[]; Where =& means that both $a and $foo[<next index>] should point to same place, and in your example they both point to null so: var_dump($a, $foo); Outputs: NULL array(1) { [0]=> &NULL } For more info: http://www.php.net/manual/en/language.references.whatare.php Previous Comments: ------------------------------------------------------------------------ [2009-04-30 13:51:57] feldkamp at gameforge dot de Description: ------------ Using array-operator to access a non-existing key of a referenced variable turns variables that are false or an empty string into arrays. Reproduce code: --------------- <? $abc = false; // or '' var_dump($abc); $a = &$abc['unsetKey']; var_dump($abc); ?> Expected result: ---------------- Warning: Cannot use a scalar value as an array Actual result: -------------- boolean false array 'unsetKey' => null ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=48121&edit=1

« previous php.bugs (#136579) next »