#24436 [Com]: isset() and empty() produce errors with non-existent variables in classes
| From: | Nico dot Laus dot 2001 at gmx dot de | Date: | Tue, 08 Jul 2003 23:02:47 +0000 |
| Subject: | #24436 [Com]: 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-43493@lists.php.net to get a copy of this message | ||
ID: 24436
Comment by: Nico dot Laus dot 2001 at gmx dot de
Reported By: Nico dot Laus dot 2002 at gmx dot de
Status: Closed
Bug Type: Zend Engine 2 problem
Operating System: WinXP SP1
PHP Version: 5CVS-2003-07-01 (dev)
New Comment:
I've got the newest CVS of PHP now, but this Bug still exists
-> I've tried the sample-code by "postings-php-bug at hans-spath dot
de" and I got the same output as before - with code1 no errors, code 2
produces them
Previous Comments:
------------------------------------------------------------------------
[2003-07-05 10:17:08] sterling@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.
------------------------------------------------------------------------
[2003-07-01 09:52:36] derick@php.net
FYI: It wasn't a setting, it was me messing with the code ;-)
------------------------------------------------------------------------
[2003-07-01 09:51:29] Nico dot Laus dot 2001 at gmx dot de
same with me - I had the same output with your code
and btw: I haven't found any setting for this in php.ini
------------------------------------------------------------------------
[2003-07-01 09:43:09] postings-php-bug at hans-spath dot de
This is really weird:
===> CODE 1 <===
<?
error_reporting( E_ALL );
define( 'N', "\n" );
class test {
function test() {
echo "test\n";
if( empty($this->a[0][0]) ) echo 'empty($this->a[0][0])', N;
if( empty($this->a[0]) ) echo 'empty($this->a[0])', N;
if( empty($this->a) ) echo 'empty($this->a)', N;
if( ! isset($this->a) ) echo 'isset($this->a)', N;
if( ! isset($this->a[0]) ) echo 'isset($this->a[0])', N;
if( ! isset($this->a[0][0]) ) echo 'isset($this->a[0][0])', N;
}
}
$x = new test();
===> OUTPUT (CODE 1) <===
test
empty($this->a[0][0])
empty($this->a[0])
empty($this->a)
isset($this->a)
isset($this->a[0])
isset($this->a[0][0])
===> CODE 2 <===
<?
error_reporting( E_ALL );
define( 'N', "\n" );
class test {
function test() {
echo "test\n";
if( empty($this->a[0][0]) ) echo 'empty($this->a[0][0])', N;
// if( empty($this->a[0]) ) echo 'empty($this->a[0])', N;
// if( empty($this->a) ) echo 'empty($this->a)', N;
// if( ! isset($this->a) ) echo 'isset($this->a)', N;
// if( ! isset($this->a[0]) ) echo 'isset($this->a[0])', N;
if( ! isset($this->a[0][0]) ) echo 'isset($this->a[0][0])', N;
}
}
$x = new test();
===> OUTPUT (CODE 2) <===
PHP Notice: Undefined property: test::$a in M:\php\test.php on line
8
PHP Notice: Undefined property: test::$a in M:\php\test.php on line
13
test
<br />
<b>Notice</b>: Undefined property: test::$a in <b>M:\php\test.php</b>
on line <b>8</b><br />
empty($this->a[0][0])
<br />
<b>Notice</b>: Undefined property: test::$a in <b>M:\php\test.php</b>
on line <b>13</b><br />
isset($this->a[0][0])
===> PHP Version <===
PHP 5.0.0b2-dev (cgi-fcgi) (built: Jul 1 2003 12:10:02)
Copyright (c) 1997-2003 The PHP Group
Zend Engine v2.0.0-dev, Copyright (c) 1998-2003 Zend Technologies
------------------------------------------------------------------------
[2003-07-01 09:40:12] Nico dot Laus dot 2001 at gmx dot de
hmmm, I will check my php.ini, maybe I can configure my php in the way
yours is, that no such errors are displayed (this is what I want)
-> I'll let you know whether I can change this with php.ini or it is
really a bug ;)
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/24436
--
Edit this bug report at http://bugs.php.net/?id=24436&edit=1