#24436 [Bgs]: isset() and empty() produce errors with non-existent variables in classes
| From: | derick@php.net | Date: | Tue, 01 Jul 2003 14:06:24 +0000 |
| Subject: | #24436 [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-42979@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: Bogus
Bug Type: Class/Object related
Operating System: WinXP SP1
PHP Version: 5CVS-2003-07-01 (dev)
New Comment:
It's weird though... I can't get it to show errors at all here
anyway...
Previous Comments:
------------------------------------------------------------------------
[2003-07-01 08:39:37] Nico dot Laus dot 2001 at gmx dot de
of course using $this->test should display an error, but by checking
whether it exists, too??
-> as I said, in earlier versions this has not returned an error
------------------------------------------------------------------------
[2003-07-01 08:36:31] derick@php.net
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...
------------------------------------------------------------------------
[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