ID: 30337 User updated by: jorma dot tuomainen at softera dot fi Reported By: jorma dot tuomainen at softera dot fi -Status: Feedback +Status: Open Bug Type: Class/Object related Operating System: Solaris PHP Version: 5.0.1 Assigned To: andi New Comment:
No, I'm not using compatibility mode. If this is wanted behaviour it should least be mentioned in the documentation. I still don't understand why empty() have to behave that way. Since that makes perfectly good function for a good purpose go to waste on objects. Is there going to be some function for checking empty objects(no methods or properties) or do I need to implement that myself? Previous Comments: ------------------------------------------------------------------------ [2004-10-06 22:05:06] [EMAIL PROTECTED] Does this also happen in zend.ze1_compatibility_mode? This was changed for non-compatibility mode with the change of moving objects to handles. As far as the new OO model is concerned objects are always handles, they are always true and they aren't empty. This is due to objects being an entity of their own now and not just a different syntax for accessing an array like structure. Just an example of why empty() might not make sense with objects is how you'd expect it to work with private/public/protected members. ------------------------------------------------------------------------ [2004-10-06 14:28:55] [EMAIL PROTECTED] Is this true Andi? ------------------------------------------------------------------------ [2004-10-06 14:19:26] jorma dot tuomainen at softera dot fi Description: ------------ Empty() does not return true on empty objects. My understanding is that object that does not have methods or properties is empty(am I wrong?). Someone reported same thing on PHP 5 RC2 and it's still open w/o comments http://bugs.php.net/bug.php?id=28502 Reproduce code: --------------- <?php class nuthin { } $bar=new nuthin; $foo=new stdClass; echo empty($bar); echo empty($foo); ?> Expected result: ---------------- 11 Actual result: -------------- nothing aka empty page ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=30337&edit=1