#38741 [Opn->Bgs]: inconsistent feedback when accessing a null object
| From: | tony2001@php.net | Date: | Fri, 08 Sep 2006 09:16:30 +0000 |
| Subject: | #38741 [Opn->Bgs]: inconsistent feedback when accessing a null object | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-101863@lists.php.net to get a copy of this message | ||
ID: 38741
Updated by: tony2001@php.net
Reported By: fh at ez dot no
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: linux
PHP Version: 5.1.6
New Comment:
Undefined variables result in notices, as well as undefined
attributes.
Undefined functions result in fatal errors, as well as undefined
methods.
No bug here.
Previous Comments:
------------------------------------------------------------------------
[2006-09-07 12:06:57] fh at ez dot no
Description:
------------
Accessing a null object will only result in a notice if
you are accessing a property but a fatal error if you are
trying to access a method.
This is especially strange if the object you expected to
access uses __get and so you actually expect your code to
fail.
I think at the very least that the notice should be
upgraded to a warning. An error is also in place since
accessing a member variable of a null value is most
probably a serious problem in your application.
Reproduce code:
---------------
<?php
$var = null;
echo $var->member; // notice
$var->member(); // fatal error
?>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=38741&edit=1