ID: 15103
Updated by: hholzgra
Reported By: [EMAIL PROTECTED]
Old Status: Open
Status: Closed
Bug Type: Class/Object related
Operating System: any
PHP Version: 4.1.1
New Comment:
the same is true for empty arrays,
"$something == false" is equivalent to
"empty($something)"
Previous Comments:
------------------------------------------------------------------------
[2002-01-18 11:25:17] [EMAIL PROTECTED]
The code
<?
class A { function foo() {} }
$a = new A;
var_dump($a);
if ($a == false) echo "hahaha";
?>
outputs
"object(a)(0) { } hahaha"
So, for some strange reason PHP thinks that object without data members
is "false". Of course, if we replace "==" with "===", it all works
fine, but that is still a bug.
This problem exists in all existing PHP versions on all platforms.
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=15103&edit=1
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]