SimpleXMLElement_xpath.phpt 566 B

123456789101112131415161718192021
  1. --TEST--
  2. Testing xpath() with invalid XML
  3. --EXTENSIONS--
  4. simplexml
  5. --FILE--
  6. <?php
  7. // gracefully recover from parsing of invalid XML; not available in PHP
  8. const XML_PARSE_RECOVER = 1;
  9. // we're not interested in checking concrete warnings regarding invalid XML
  10. $xml = @simplexml_load_string("XXXXXXX^", 'SimpleXMLElement', XML_PARSE_RECOVER);
  11. // $xml is supposed to hold a SimpleXMLElement, but not FALSE/NULL
  12. try {
  13. var_dump($xml->xpath("BBBB"));
  14. } catch (Error $e) {
  15. echo $e->getMessage(), "\n";
  16. }
  17. ?>
  18. --EXPECT--
  19. SimpleXMLElement is not properly initialized