From:
Operating system: Linux
PHP version: Irrelevant
Package: SimpleXML related
Bug Type: Feature/Change Request
Bug description:Casting SimpleXMLElement('0') to boolean results in true
Description:
------------
I understand the bug I am reporting is described in the manual, which is
why I am reporting it as a feature request. When casting SimpleXMLElements
to boolean, most values comply with the way PHP casts them. There is
however one exception: the string '0' is cast to true, which is unexpected.
This is especially annoying when using XmlRpc, which uses
<boolean>0</boolean> for its values.
Test script:
---------------
<?php
var_dump((bool)new SimpleXMLElement("<w>0</w>"));
Expected result:
----------------
bool(false)
Actual result:
--------------
bool(true)
--
Edit bug report at http://bugs.php.net/bug.php?id=52482&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=52482&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=52482&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=52482&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=52482&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=52482&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=52482&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=52482&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=52482&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=52482&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=52482&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=52482&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=52482&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=52482&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=52482&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52482&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=52482&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=52482&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=52482&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=52482&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=52482&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=52482&r=mysqlcfg