|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46122 Simplexmlelement typecasts right to string and int but not to bool
Submitted: 2008-09-19 12:23 UTC Modified: 2008-11-03 01:00 UTC
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: dirk at heilig-online dot com Assigned:
Status: No Feedback Package: SimpleXML related
PHP Version: 5.2.6 OS: Debian
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2008-09-19 12:23 UTC] dirk at heilig-online dot com
Simplexmlelement->node auto-typecasts right to int or string but a typecast to bool does the same thing as is_set().
to check if a node contains a true or a false value you have to check 

Reproduce code:
$xmlelement=new SimpleXMLElement($xmlstring);
echo "(int)element: ";
echo "--\n";
echo "(bool)element: ";
echo "--\n";
echo "(bool)(string)element: ";

Expected result:
(int)element: int(0)
(bool)element: bool(false)
(bool)(string)element: bool(false)

Actual result:
(int)element: int(0)
(bool)element: bool(true)
(bool)(string)element: bool(false)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-26 11:18 UTC]
Please try using this CVS snapshot:
For Windows:

 [2008-11-03 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 15 04:01:28 2024 UTC