|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2005-10-30 19:21 UTC] lists at cyberlot dot net
 Description:
------------
$xml object returns false, this worked in RC1 fails in RC3 and RC4 never tested RC2
xml string of <doc>test</doc> DOES pass test. Its only when you have subchildren children that the $xml object fails to pass.
<doc><test>test</test></doc> fails
<doc>test</doc> Passes.
if(is_object($xml)) { works, and is prob the best method to use but one would expect $xml to be "true"
Realize this might be considered a dupe of bug #31045 however bug #34199 suggests the same issue that states this is fixed.
Reproduce code:
---------------
<?
  $string = "<doc><login>kkl</login><password>klk</password></doc>";
  $xml = simplexml_load_String($string);
  if($xml) {
    echo "Passed test\n";
  } else {
    echo "Even though is object still failed false test\n";
  }
?>
Expected result:
----------------
Expect output of Passed test
Actual result:
--------------
output of Even though is object still failed false test
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 01:00:01 2025 UTC | 
Note that if you change $string to: $string = str_replace('><','> <',"<doc><login>kkl</ login><password>klk</password></doc>"); It passes.