php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #68540 Documenation about checking SimpleXML needs clarification
Submitted: 2014-12-03 10:47 UTC Modified: 2021-01-08 11:05 UTC
Votes:4
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: seo at gacek dot vot dot pl Assigned: cmb (profile)
Status: Closed Package: SimpleXML related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: seo at gacek dot vot dot pl
New email:
PHP Version: OS:

 

 [2014-12-03 10:47 UTC] seo at gacek dot vot dot pl
Description:
------------
---
From manual page: http://www.php.net/language.types.boolean
---

Documentation needs some more information, to clarify when simplexml object is considered true.

More information here: http://stackoverflow.com/a/27157104/1430632


Tried adding it to documentation
  <warning>
   <simpara>
    <literal>SimpleXML</literal> evaluates to &true; only if it has child nodes or properties - only then object is not considered empty.
    To check if <literal>SimpleXML</literal> object has &string; value you have to cast it to &string;
   </simpara>
  </warning>


Patches

Leader (last revision 2017-11-13 05:15 UTC by Terserah26 at gmail dot com)

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-05-27 22:59 UTC] cmb@php.net
-Status: Open +Status: Verified
 [2015-05-27 22:59 UTC] cmb@php.net
I agree that the wording of the documentation is unfortunate:

| SimpleXML objects created from empty tags

An empty tag would most likely be something like <>. Speaking of
empty elements would be better, but would not take into account
that an empty element may have attributes (not properties), and in
this case casting the respective SimpleXML to bool would also
yield true.
 [2017-01-28 12:50 UTC] cmb@php.net
-Package: Documentation problem +Package: SimpleXML related
 [2021-01-08 11:05 UTC] cmb@php.net
-Summary: Documenattion about checking SimpleXML needs clarification +Summary: Documenation about checking SimpleXML needs clarification -Assigned To: +Assigned To: cmb
 [2021-01-08 11:07 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=c4ac84bedb318bd3fad78c92379e3becd725a7b9
Log: Fix #68540: Documenation about checking SimpleXML needs clarification
 [2021-01-08 11:07 UTC] cmb@php.net
-Status: Verified +Status: Closed
 [2021-01-09 02:35 UTC] mumumu@php.net
Automatic comment on behalf of mumumu@mumumu.org
Revision: http://git.php.net/?p=doc/ja.git;a=commit;h=730e862a892e3f61450f47f0a1f983807c520f08
Log: Fix #68540: Documenation about checking SimpleXML needs clarification
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 13:01:30 2024 UTC