#43785 [Opn->Bgs]: the puzzling References Design

From: Date: Sat, 12 Jan 2008 15:34:54 +0000
Subject: #43785 [Opn->Bgs]: the puzzling References Design
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-121225@lists.php.net to get a copy of this message
ID: 43785 Updated by: tony2001@php.net Reported By: hackfan at vip dot sina dot com -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: Windows XP SP2 PHP Version: 5.2.5 New Comment: There is no notice so that you could pass variables by reference with no need to declare them before. Previous Comments: ------------------------------------------------------------------------ [2008-01-08 10:00:58] hackfan at vip dot sina dot com <?php error_reporting(E_ALL); $b = &$a; if( isset($a) === false ) { $a++; echo $a; } else { echo 'Hello'; } ?> print: 1 ------------------------------------------------------------------------ [2008-01-08 09:26:52] hackfan at vip dot sina dot com Description: ------------ When I use referenes to an unvalued var, I found it valued to NULL and there isn't a notice printed. Then I'd like to ask: what is notice designed for? Reproduce code: --------------- <?php error_reporting(E_ALL); $b = &$a; $a++; echo $a; ?> Expected result: ---------------- PHP Notice: Undefined variable: a in E:\a.php on line 4 1 Actual result: -------------- 1 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43785&edit=1

« previous php.bugs (#121225) next »