#34199 [Opn->Ana]: SimpleXMLElement is Schroedinger's Cat
| From: | rrichards@php.net | Date: | Sat, 20 Aug 2005 20:33:32 +0000 |
| Subject: | #34199 [Opn->Ana]: SimpleXMLElement is Schroedinger's Cat | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-83834@lists.php.net to get a copy of this message | ||
ID: 34199
Updated by: rrichards@php.net
Reported By: rasmus@php.net
-Status: Open
+Status: Analyzed
-Bug Type: SimpleXML related
+Bug Type: Scripting Engine problem
Operating System: Any
PHP Version: 5CVS-2005-08-20 (CVS)
New Comment:
if ($kids) if handled by ZEND_JMPZ_SPEC_CV_HANDLER which ends up
calling i_zend_is_true and returning TRUE because $kids is an object.
if (! $kids) is handled by ZEND_BOOL_NOT_SPEC_CV_HANDLER which calls
convert_to_boolean and ends up calling the objects cast_object handler,
which in this case is sxe_object_cast and returns FALSE because object
is really empty.
Previous Comments:
------------------------------------------------------------------------
[2005-08-20 21:13:15] rasmus@php.net
Description:
------------
An empty SimpleXMLElement object is both true and false
Reproduce code:
---------------
$xml = "<root></root>";
$xml = simplexml_load_string($xml);
$kids = $xml->children();
if($kids) echo "True";
if(!$kids) echo "False";
Expected result:
----------------
False
Actual result:
--------------
TrueFalse
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34199&edit=1