xref: /PHP-5.3/ext/xml/tests/xml_parse_error.phpt (revision 3fb86b0b)
1--TEST--
2Test xml_parse() function : error conditions
3--SKIPIF--
4<?php
5if (!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
17echo "*** Testing xml_parse() : error conditions ***\n";
18
19
20//Test xml_parse with one more than the expected number of arguments
21echo "\n-- Testing xml_parse() function with more than expected no. of arguments --\n";
22
23$data = 'string_val';
24$isFinal = false;
25$extra_arg = 10;
26var_dump( xml_parse(null, $data, $isFinal, $extra_arg) );
27
28// Testing xml_parse with one less than the expected number of arguments
29echo "\n-- Testing xml_parse() function with less than expected no. of arguments --\n";
30
31var_dump( xml_parse(null) );
32
33echo "Done";
34?>
35--EXPECTF--
36*** Testing xml_parse() : error conditions ***
37
38-- Testing xml_parse() function with more than expected no. of arguments --
39
40Warning: xml_parse() expects at most 3 parameters, 4 given in %s on line %d
41NULL
42
43-- Testing xml_parse() function with less than expected no. of arguments --
44
45Warning: xml_parse() expects at least 2 parameters, 1 given in %s on line %d
46NULL
47Done
48
49