bug81351.phpt 998 B

1234567891011121314151617181920212223242526
  1. --TEST--
  2. Bug #81351 (xml_parse may fail, but has no error code)
  3. --EXTENSIONS--
  4. xml
  5. --FILE--
  6. <?php
  7. $xml = <<<XML
  8. <?xml version="1.0" encoding="utf-8"?>
  9. <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  10. <soap:Body>
  11. <X xmlns="example.org">
  12. XML;
  13. $parser = xml_parser_create_ns('UTF-8');
  14. $success = xml_parse($parser, $xml, false);
  15. $code = xml_get_error_code($parser);
  16. $error = xml_error_string($code);
  17. echo "xml_parse returned $success, xml_get_error_code = $code, xml_error_string = $error\r\n";
  18. $success = xml_parse($parser, 'Y>', true);
  19. $code = xml_get_error_code($parser);
  20. $error = xml_error_string($code);
  21. echo "xml_parse returned $success, xml_get_error_code = $code, xml_error_string = $error\r\n";
  22. ?>
  23. --EXPECT--
  24. xml_parse returned 1, xml_get_error_code = 0, xml_error_string = No error
  25. xml_parse returned 0, xml_get_error_code = 5, xml_error_string = Invalid document end