#30337 [Opn->Csd]: empty() does not return true on empty objects
| From: | vrana@php.net | Date: | Thu, 28 Oct 2004 09:22:01 +0000 |
| Subject: | #30337 [Opn->Csd]: empty() does not return true on empty objects | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969364698@lists.php.net to get a copy of this message | ||
ID: 30337
Updated by: vrana@php.net
Reported By: jorma dot tuomainen at softera dot fi
-Status: Open
+Status: Closed
Bug Type: Documentation problem
Operating System: Solaris
PHP Version: 5.0.1
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
"In PHP 4 and earlier also objects with empty properties are considered
empty while not in PHP 5."
Previous Comments:
------------------------------------------------------------------------
[2004-10-26 16:45:36] nlopess@php.net
I think that the empty() page deserves a little note about this.
Can you please add this, Aidan? :)
------------------------------------------------------------------------
[2004-10-25 08:39:41] aidan@php.net
It's covered under http://php.net/migration5
Perhaps this deserves a note on the empty() page, perhaps not.
------------------------------------------------------------------------
[2004-10-23 16:15:27] tony2001@php.net
"As far as the new OO model is concerned objects are always handles,
they are always true and they aren't empty." (c) Andi
Making it a documentation problem then.
------------------------------------------------------------------------
[2004-10-11 20:48:41] andrey@php.net
<?php
function empty_object($obj){
return count((array)$obj)==0;
}
class foo{var $a=1;}
$std=new stdclass;
$foo=new foo;
var_dump(empty_object($obj), empty_object($foo));
?>
bool(true)
bool(false)
------------------------------------------------------------------------
[2004-10-08 13:38:29] th at zirkonium dot net
I find this bug pretty irritating too. In my opinion
empty() shouldn't behave this way, or at least like Jorma
said, it should be mentioned in docs or some other way to
check if objects are empty.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/30337
--
Edit this bug report at http://bugs.php.net/?id=30337&edit=1