From:             tomas dot matousek at matfyz dot cz
Operating system: WinXP
PHP version:      5.0.0RC2
PHP Bug Type:     Zend Engine 2 problem
Bug description:  empty statement misbehaves on objects

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 bug report at http://bugs.php.net/?id=28502&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=28502&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=28502&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=28502&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=28502&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=28502&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=28502&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=28502&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=28502&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=28502&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=28502&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=28502&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=28502&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28502&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=28502&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=28502&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=28502&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28502&r=float

Reply via email to