#20018 [Fbk->Csd]: empty($this->property) always returns TRUE inside class method
| From: | tater at potatoe dot com | Date: | Sun, 03 Nov 2002 05:04:44 +0000 |
| Subject: | #20018 [Fbk->Csd]: empty($this->property) always returns TRUE inside class method | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-23970@lists.php.net to get a copy of this message | ||
ID: 20018
User updated by: tater@potatoe.com
Reported By: tater@potatoe.com
-Status: Feedback
+Status: Closed
Bug Type: Zend Engine 2 problem
Operating System: OS X 10.1
PHP Version: 4CVS-2002-10-21
New Comment:
Fixed in latest CVS release.
Previous Comments:
------------------------------------------------------------------------
[2002-11-02 11:00:21] iliaa@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php4-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-latest.zip
------------------------------------------------------------------------
[2002-10-21 23:28:49] tater@potatoe.com
empty() seems to always return TRUE when testing an object
property from inside a method of the object. it works OK
on regular variables, or when testing the property externally.
test code:
<?php
class test
{
function test()
{
$this->x = NULL;
print "<li>this->x={$this->x}\n";
print "<li>is this->x empty? ".(empty($this->x) ? "yes" :
"no")."\n";
$this->x = 'i am not empty';
print "<li>this->x={$this->x}\n";
print "<li>is this->x empty? ".(empty($this->x) ? "yes" :
"no")."\n";
$x = NULL;
print "<li>x={$x}\n";
print "<li>is x empty? ".(empty($x) ? "yes" :
"no")."\n";
$x = 'i am not empty';
print "<li>x={$x}\n";
print "<li>is x empty? ".(empty($x) ? "yes" :
"no")."\n";
}
}
$x = new test;
?>
output:
<li>this->x=
<li>is this->x empty? yes
<li>this->x=i am not empty
<li>is this->x empty? yes
<li>x=
<li>is x empty? yes
<li>x=i am not empty
<li>is x empty? no
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=20018&edit=1