ID:               20018
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Feedback
 Bug Type:         Zend Engine 2 problem
 Operating System: OS X 10.1
 PHP Version:      4CVS-2002-10-21
 New Comment:

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




Previous Comments:
------------------------------------------------------------------------

[2002-10-21 23:28:49] [EMAIL PROTECTED]

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

Reply via email to