Bug #54556 [Opn]: array access to empty var does not trigger a notice

From: Date: Wed, 27 Apr 2011 07:56:52 +0000
Subject: Bug #54556 [Opn]: array access to empty var does not trigger a notice
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-160388@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=54556&edit=1 ID: 54556 User updated by: kal dot el dot ias at gmx dot net Reported by: kal dot el dot ias at gmx dot net -Summary: array access to empty class member does not trigger a notice +Summary: array access to empty var does not trigger a notice Status: Open Type: Bug Package: Class/Object related Operating System: Ubuntu 10.04.2 LTS PHP Version: trunk-SVN-2011-04-18 (snap) Block user comment: N Private report: N New Comment: title changed Previous Comments: ------------------------------------------------------------------------ [2011-04-26 14:42:31] kal dot el dot ias at gmx dot net bump ------------------------------------------------------------------------ [2011-04-18 10:59:58] kal dot el dot ias at gmx dot net hmm, it's the same for normal variables and it's not an error reporting problem. <?php error_reporting(E_ALL); $foo = null; var_dump($bar, $foo['blah']); OUTPUT: PHP Notice: Undefined variable: bar in /tmp/test2.php on line 5 NULL NULL -- well, i had the feeling that array access on null values would cause an notice. ------------------------------------------------------------------------ [2011-04-18 10:23:58] kal dot el dot ias at gmx dot net Description: ------------ see script Test script: --------------- <?php class Foo { private $bar; function nonotice(){ var_dump($this->bar['yeah']); } } $foo = new Foo(); $foo->nonotice(); Expected result: ---------------- notice: access to undefined array blah Actual result: -------------- NULL ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=54556&edit=1

« previous php.bugs (#160388) next »