ID: 28502
Updated by: [EMAIL PROTECTED]
Reported By: tomas dot matousek at matfyz dot cz
-Status: Open
+Status: Bogus
-Bug Type: Zend Engine 2 problem
+Bug Type: Documentation problem
Operating System: WinXP
PHP Version: 5.0.0RC2
New Comment:
This is documentation problem duplicate to #30337 (younger but with
more info).
Previous Comments:
------------------------------------------------------------------------
[2004-05-24 11:16:12] tomas dot matousek at matfyz dot cz
Description:
------------
There is written in the manual that empty($object) == TRUE, where
$object has empty properties.
>> empty() returns FALSE if var has a non-empty or non-zero value. In
otherwords, "", 0, "0", NULL, FALSE, array(), var $var;, and objects
with empty properties, are all considered empty. TRUE is returned if
var is empty. <<
But IMHO there is an error if $object is instance of class A {}.
I think the A's instance has no properties hence it is an "object with
empty properties".
So why empty($a) == FALSE where $a = new A?
It seems that empty() does never return TRUE.
BTW: What does "var $var;" mean?
Reproduce code:
---------------
class A {}
$a = new A;
var_dump(empty($a));
Expected result:
----------------
bool(true)
Actual result:
--------------
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28502&edit=1