xml_parse_error.phpt 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. --TEST--
  2. Test xml_parse() function : error conditions
  3. --SKIPIF--
  4. <?php
  5. if (!extension_loaded("xml")) {
  6. print "skip - XML extension not loaded";
  7. }
  8. ?>
  9. --FILE--
  10. <?php
  11. /* Prototype : proto int xml_parse(resource parser, string data [, int isFinal])
  12. * Description: Start parsing an XML document
  13. * Source code: ext/xml/xml.c
  14. * Alias to functions:
  15. */
  16. echo "*** Testing xml_parse() : error conditions ***\n";
  17. //Test xml_parse with one more than the expected number of arguments
  18. echo "\n-- Testing xml_parse() function with more than expected no. of arguments --\n";
  19. $data = 'string_val';
  20. $isFinal = false;
  21. $extra_arg = 10;
  22. var_dump( xml_parse(null, $data, $isFinal, $extra_arg) );
  23. // Testing xml_parse with one less than the expected number of arguments
  24. echo "\n-- Testing xml_parse() function with less than expected no. of arguments --\n";
  25. var_dump( xml_parse(null) );
  26. echo "Done";
  27. ?>
  28. --EXPECTF--
  29. *** Testing xml_parse() : error conditions ***
  30. -- Testing xml_parse() function with more than expected no. of arguments --
  31. Warning: xml_parse() expects at most 3 parameters, 4 given in %s on line %d
  32. NULL
  33. -- Testing xml_parse() function with less than expected no. of arguments --
  34. Warning: xml_parse() expects at least 2 parameters, 1 given in %s on line %d
  35. NULL
  36. Done