#24436 [NEW]: isset() and empty() produce errors with non-existent variables in classes
| From: | Nico dot Laus dot 2002 at gmx dot de | Date: | Tue, 01 Jul 2003 13:34:30 +0000 |
| Subject: | #24436 [NEW]: isset() and empty() produce errors with non-existent variables in classes | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-42976@lists.php.net to get a copy of this message | ||
From: Nico dot Laus dot 2002 at gmx dot de
Operating system: WinXP SP1
PHP version: 5CVS-2003-07-01 (dev)
PHP Bug Type: Class/Object related
Bug description: isset() and empty() produce errors with non-existent variables in classes
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 bug report at http://bugs.php.net/?id=24436&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=24436&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=24436&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=24436&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=24436&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=24436&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=24436&r=support
Expected behavior: http://bugs.php.net/fix.php?id=24436&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=24436&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=24436&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=24436&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24436&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=24436&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=24436&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=24436&r=gnused