php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24436 isset() and empty() produce errors with non-existent variables in classes
Submitted: 2003-07-01 08:34 UTC Modified: 2003-11-05 00:55 UTC
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: Nico dot Laus dot 2002 at gmx dot de Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5CVS-2003-07-01 (dev) OS: WinXP SP1
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: Nico dot Laus dot 2002 at gmx dot de
New email:
PHP Version: OS:

 

 [2003-07-01 08:34 UTC] 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 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-07-22 08:50 UTC] zeev@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 21:01:27 2024 UTC