PageRenderTime 45ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/hphp/test/zend/good/ext/xml/tests/xml_parse_error.php

http://github.com/facebook/hiphop-php
PHP | 25 lines | 12 code | 6 blank | 7 comment | 0 complexity | e11b8c30179414f40619773998a8fb89 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. <?hh
  2. /* Prototype : proto int xml_parse(resource parser, string data [, int isFinal])
  3. * Description: Start parsing an XML document
  4. * Source code: ext/xml/xml.c
  5. * Alias to functions:
  6. */
  7. <<__EntryPoint>> function main(): void {
  8. echo "*** Testing xml_parse() : error conditions ***\n";
  9. //Test xml_parse with one more than the expected number of arguments
  10. echo "\n-- Testing xml_parse() function with more than expected no. of arguments --\n";
  11. $data = 'string_val';
  12. $isFinal = false;
  13. $extra_arg = 10;
  14. try { var_dump( xml_parse(null, $data, $isFinal, $extra_arg) ); } catch (Exception $e) { echo "\n".'Warning: '.$e->getMessage().' in '.__FILE__.' on line '.__LINE__."\n"; }
  15. // Testing xml_parse with one less than the expected number of arguments
  16. echo "\n-- Testing xml_parse() function with less than expected no. of arguments --\n";
  17. try { var_dump( xml_parse(null) ); } catch (Exception $e) { echo "\n".'Warning: '.$e->getMessage().' in '.__FILE__.' on line '.__LINE__."\n"; }
  18. echo "Done";
  19. }