#34199 [NEW]: SimpleXMLElement is Shcroedinger's Cat
| From: | rasmus@php.net | Date: | Sat, 20 Aug 2005 19:13:16 +0000 |
| Subject: | #34199 [NEW]: SimpleXMLElement is Shcroedinger's Cat | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-83831@lists.php.net to get a copy of this message | ||
From: rasmus@php.net
Operating system: Any
PHP version: 5CVS-2005-08-20 (CVS)
PHP Bug Type: SimpleXML related
Bug description: SimpleXMLElement is Shcroedinger's Cat
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 bug report at http://bugs.php.net/?id=34199&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34199&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34199&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34199&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=34199&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=34199&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=34199&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=34199&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=34199&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=34199&r=support
Expected behavior: http://bugs.php.net/fix.php?id=34199&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=34199&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=34199&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=34199&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34199&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=34199&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=34199&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=34199&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=34199&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=34199&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=34199&r=mysqlcfg