Bug #15103: object without any data members equals to false
| From: | phpclub at digiways dot com | Date: | Fri, 18 Jan 2002 16:25:18 +0000 |
| Subject: | Bug #15103: object without any data members equals to false | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-77446@lists.php.net to get a copy of this message | ||
From: phpclub@digiways.com
Operating system: any
PHP version: 4.1.1
PHP Bug Type: Class/Object related
Bug description: object without any data members equals to false
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 bug report at: http://bugs.php.net/?id=15103&edit=1