bug70962.phpt 772 B

1234567891011121314151617181920212223242526272829303132333435
  1. --TEST--
  2. Bug #70962 (XML_OPTION_SKIP_WHITE strips embedded whitespace)
  3. --EXTENSIONS--
  4. xml
  5. --FILE--
  6. <?php
  7. function parseAndOutput($xml)
  8. {
  9. $parser = xml_parser_create();
  10. xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
  11. xml_parse_into_struct($parser, $xml, $values);
  12. return $values;
  13. }
  14. $xml = "<a><b>&lt;d&gt;\n &lt;e&gt;</b><![CDATA[ ]]><c>\n \t</c></a>";
  15. $parsed = parseAndOutput($xml);
  16. // Check embedded whitespace is not getting skipped.
  17. echo $parsed[1]['value'] . "\n";
  18. // Check XML_OPTION_SKIP_WHITE ignores values of tags containing whitespace characters only.
  19. var_dump(isset($parsed[2]['value']));
  20. // Check XML_OPTION_SKIP_WHITE ignores empty <![CDATA[ ]]> values.
  21. var_dump(count($parsed));
  22. ?>
  23. --EXPECT--
  24. <d>
  25. <e>
  26. bool(false)
  27. int(4)