PageRenderTime 62ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/hphp/test/zend/bad/ext/xml/tests/bug50576.php

http://github.com/facebook/hiphop-php
PHP | 29 lines | 25 code | 4 blank | 0 comment | 0 complexity | c2febfa64b0c1d5d4bbb6c67093110b2 MD5 | raw file
Possible License(s): LGPL-2.1, BSD-2-Clause, BSD-3-Clause, MPL-2.0-no-copyleft-exception, MIT, LGPL-2.0, Apache-2.0
  1. <?php
  2. $XML = <<<XML
  3. <?xml version="1.0"?>
  4. <ns1:listOfAwards xmlns:ns1="http://www.fpdsng.com/FPDS">
  5. <ns1:count>
  6. <ns1:total>867</ns1:total>
  7. </ns1:count>
  8. </ns1:listOfAwards>
  9. XML;
  10. $xml_parser = xml_parser_create();
  11. xml_parser_set_option($xml_parser, XML_OPTION_SKIP_TAGSTART, 4);
  12. xml_parse_into_struct($xml_parser, $XML, $vals, $index);
  13. echo 'Index array' . PHP_EOL;
  14. print_r($index);
  15. echo 'Vals array' . PHP_EOL;
  16. print_r($vals);
  17. xml_parser_free($xml_parser);
  18. function startElement($parser, $name, $attribs) { echo $name . PHP_EOL; }
  19. function endElement($parser, $name) { echo $name . PHP_EOL; }
  20. $xml_parser = xml_parser_create();
  21. xml_set_element_handler($xml_parser, 'startElement', 'endElement');
  22. xml_parser_set_option($xml_parser, XML_OPTION_SKIP_TAGSTART, 4);
  23. xml_parse($xml_parser, $XML);
  24. xml_parser_free($xml_parser);
  25. ?>