#24436 [Opn->Bgs]: isset() and empty() produce errors with non-existent variables in classes
| From: | derick@php.net | Date: | Tue, 01 Jul 2003 13:36:31 +0000 |
| Subject: | #24436 [Opn->Bgs]: isset() and empty() produce errors with non-existent variables in classes | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-42977@lists.php.net to get a copy of this message | ||
ID: 24436
Updated by: derick@php.net
Reported By: Nico dot Laus dot 2002 at gmx dot de
-Status: Open
+Status: Bogus
Bug Type: Class/Object related
Operating System: WinXP SP1
PHP Version: 5CVS-2003-07-01 (dev)
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
$this->test doesn't exist... of course it should give a warning...
Previous Comments:
------------------------------------------------------------------------
[2003-07-01 08:34:30] Nico dot Laus dot 2002 at gmx dot de
Description:
------------
When checking variables either not declared or after having unset()
them with empty() or isset(), some errors occure.
In former times, empty() and isset() have not produced errors - even if
it is a NOTICE now.
-> hopefully this is not the way it is meant to be - I think, than it's
not only me who has to rewrite his code
Reproduce code:
---------------
class test {
function __construct() {
if (empty($this->test[0][0])) { print "test1";}
if (!isset($this->test[0][0])) { print "test2";}
}
}
$test1 = new test();
Expected result:
----------------
test1test2
Actual result:
--------------
Notice: Undefined property: test::$test in
D:\inetpub\wwwroot\fmwars\temp.php on line 41
test1Notice: Undefined property: test::$test in
D:\inetpub\wwwroot\fmwars\temp.php on line 42
test2
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=24436&edit=1