diff options
author | Ant Phillips <ant@php.net> | 2008-12-03 19:09:14 +0000 |
---|---|---|
committer | Ant Phillips <ant@php.net> | 2008-12-03 19:09:14 +0000 |
commit | 3fb86b0b9e79e6a3312b694f30ee627e2e1b325c (patch) | |
tree | f43b1d1f7b1629710a87c7ac58863930ba7e44b4 | |
parent | c9fff9cc2dfb468a8f0215fe0fb097badae1a28f (diff) | |
download | php-git-3fb86b0b9e79e6a3312b694f30ee627e2e1b325c.tar.gz |
XML tests: checked on PHP 5.2.6, 5.3 and 6.0 (Windows, Linux and Linux 64 bit).
57 files changed, 8001 insertions, 0 deletions
diff --git a/ext/xml/tests/utf8_decode_error.phpt b/ext/xml/tests/utf8_decode_error.phpt new file mode 100644 index 0000000000..ed39db5c12 --- /dev/null +++ b/ext/xml/tests/utf8_decode_error.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test utf8_decode() function : error conditions +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto string utf8_decode(string data) + * Description: Converts a UTF-8 encoded string to ISO-8859-1 + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +/* + * add a comment here to say what the test is supposed to do + */ + +echo "*** Testing utf8_decode() : error conditions ***\n"; + +// Zero arguments +echo "\n-- Testing utf8_decode() function with Zero arguments --\n"; +var_dump( utf8_decode() ); + +//Test utf8_decode with one more than the expected number of arguments +echo "\n-- Testing utf8_decode() function with more than expected no. of arguments --\n"; +$data = 'string_val'; +$extra_arg = 10; +var_dump( utf8_decode($data, $extra_arg) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing utf8_decode() : error conditions *** + +-- Testing utf8_decode() function with Zero arguments -- + +Warning: utf8_decode() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing utf8_decode() function with more than expected no. of arguments -- + +Warning: utf8_decode() expects exactly 1 parameter, 2 given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/utf8_decode_variation1.phpt b/ext/xml/tests/utf8_decode_variation1.phpt new file mode 100644 index 0000000000..5966531723 --- /dev/null +++ b/ext/xml/tests/utf8_decode_variation1.phpt @@ -0,0 +1,176 @@ +--TEST-- +Test utf8_decode() function : usage variations - different types for data +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto string utf8_decode(string data) + * Description: Converts a UTF-8 encoded string to ISO-8859-1 + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing utf8_decode() : usage variations ***\n"; +error_reporting(E_ALL & ~E_NOTICE); + +class aClass { + function __toString() { + return "Some Ascii Data"; + } +} + +// Initialise function arguments not being substituted (if any) + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +//array of values to iterate over +$values = array( + + // int data + 0, + 1, + 12345, + -2345, + + // float data + 10.5, + -10.5, + 10.1234567e10, + 10.7654321E-10, + .5, + + // array data + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new aClass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for data + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( utf8_decode($value) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing utf8_decode() : usage variations *** + +Arg value 0 +string(1) "0" + +Arg value 1 +string(1) "1" + +Arg value 12345 +string(5) "12345" + +Arg value -2345 +string(5) "-2345" + +Arg value 10.5 +string(4) "10.5" + +Arg value -10.5 +string(5) "-10.5" + +Arg value 101234567000 +string(12) "101234567000" + +Arg value 1.07654321E-9 +string(13) "1.07654321E-9" + +Arg value 0.5 +string(3) "0.5" + +Arg value Array + +Warning: utf8_decode() expects parameter 1 to be string, array given in %s on line %d +NULL + +Arg value Array + +Warning: utf8_decode() expects parameter 1 to be string, array given in %s on line %d +NULL + +Arg value Array + +Warning: utf8_decode() expects parameter 1 to be string, array given in %s on line %d +NULL + +Arg value Array + +Warning: utf8_decode() expects parameter 1 to be string, array given in %s on line %d +NULL + +Arg value Array + +Warning: utf8_decode() expects parameter 1 to be string, array given in %s on line %d +NULL + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value 1 +string(1) "1" + +Arg value +string(0) "" + +Arg value 1 +string(1) "1" + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value Some Ascii Data +string(15) "Some Ascii Data" + +Arg value +string(0) "" + +Arg value +string(0) "" +Done + diff --git a/ext/xml/tests/utf8_encode_error.phpt b/ext/xml/tests/utf8_encode_error.phpt new file mode 100644 index 0000000000..e1c604230f --- /dev/null +++ b/ext/xml/tests/utf8_encode_error.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test utf8_encode() function : error conditions +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto string utf8_encode(string data) + * Description: Encodes an ISO-8859-1 string to UTF-8 + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +/* + * add a comment here to say what the test is supposed to do + */ + +echo "*** Testing utf8_encode() : error conditions ***\n"; + +// Zero arguments +echo "\n-- Testing utf8_encode() function with Zero arguments --\n"; +var_dump( utf8_encode() ); + +//Test utf8_encode with one more than the expected number of arguments +echo "\n-- Testing utf8_encode() function with more than expected no. of arguments --\n"; +$data = 'string_val'; +$extra_arg = 10; +var_dump( utf8_encode($data, $extra_arg) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing utf8_encode() : error conditions *** + +-- Testing utf8_encode() function with Zero arguments -- + +Warning: utf8_encode() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing utf8_encode() function with more than expected no. of arguments -- + +Warning: utf8_encode() expects exactly 1 parameter, 2 given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/utf8_encode_variation1.phpt b/ext/xml/tests/utf8_encode_variation1.phpt new file mode 100644 index 0000000000..4b5d3c5d3c --- /dev/null +++ b/ext/xml/tests/utf8_encode_variation1.phpt @@ -0,0 +1,176 @@ +--TEST-- +Test utf8_encode() function : usage variations - <type here specifics of this variation> +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto string utf8_encode(string data) + * Description: Encodes an ISO-8859-1 string to UTF-8 + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing utf8_encode() : usage variations ***\n"; +error_reporting(E_ALL & ~E_NOTICE); + +class aClass { + function __toString() { + return "Some Ascii Data"; + } +} + +// Initialise function arguments not being substituted (if any) + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +//array of values to iterate over +$values = array( + + // int data + 0, + 1, + 12345, + -2345, + + // float data + 10.5, + -10.5, + 10.1234567e10, + 10.7654321E-10, + .5, + + // array data + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // object data + new aClass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for data + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( utf8_encode($value) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing utf8_encode() : usage variations *** + +Arg value 0 +string(1) "0" + +Arg value 1 +string(1) "1" + +Arg value 12345 +string(5) "12345" + +Arg value -2345 +string(5) "-2345" + +Arg value 10.5 +string(4) "10.5" + +Arg value -10.5 +string(5) "-10.5" + +Arg value 101234567000 +string(12) "101234567000" + +Arg value 1.07654321E-9 +string(13) "1.07654321E-9" + +Arg value 0.5 +string(3) "0.5" + +Arg value Array + +Warning: utf8_encode() expects parameter 1 to be string, array given in %s on line %d +NULL + +Arg value Array + +Warning: utf8_encode() expects parameter 1 to be string, array given in %s on line %d +NULL + +Arg value Array + +Warning: utf8_encode() expects parameter 1 to be string, array given in %s on line %d +NULL + +Arg value Array + +Warning: utf8_encode() expects parameter 1 to be string, array given in %s on line %d +NULL + +Arg value Array + +Warning: utf8_encode() expects parameter 1 to be string, array given in %s on line %d +NULL + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value 1 +string(1) "1" + +Arg value +string(0) "" + +Arg value 1 +string(1) "1" + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value +string(0) "" + +Arg value Some Ascii Data +string(15) "Some Ascii Data" + +Arg value +string(0) "" + +Arg value +string(0) "" +Done + diff --git a/ext/xml/tests/xml_error_string_error.phpt b/ext/xml/tests/xml_error_string_error.phpt new file mode 100644 index 0000000000..e1137b8383 --- /dev/null +++ b/ext/xml/tests/xml_error_string_error.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test xml_error_string() function : error conditions +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto string xml_error_string(int code) + * Description: Get XML parser error string + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +/* + * add a comment here to say what the test is supposed to do + */ + +echo "*** Testing xml_error_string() : error conditions ***\n"; + +// Zero arguments +echo "\n-- Testing xml_error_string() function with Zero arguments --\n"; +var_dump( xml_error_string() ); + +//Test xml_error_string with one more than the expected number of arguments +echo "\n-- Testing xml_error_string() function with more than expected no. of arguments --\n"; +$code = 10; +$extra_arg = 10; +var_dump( xml_error_string($code, $extra_arg) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_error_string() : error conditions *** + +-- Testing xml_error_string() function with Zero arguments -- + +Warning: xml_error_string() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing xml_error_string() function with more than expected no. of arguments -- + +Warning: xml_error_string() expects exactly 1 parameter, 2 given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_error_string_variation1.phpt b/ext/xml/tests/xml_error_string_variation1.phpt new file mode 100644 index 0000000000..b13e510364 --- /dev/null +++ b/ext/xml/tests/xml_error_string_variation1.phpt @@ -0,0 +1,179 @@ +--TEST-- +Test xml_error_string() function : usage variations - test different types for code +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto string xml_error_string(int code) + * Description: Get XML parser error string + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_error_string() : usage variations ***\n"; +error_reporting(E_ALL & ~E_NOTICE); + +class aClass { + function __toString() { + return "Some Ascii Data"; + } +} + +// Initialise function arguments not being substituted (if any) + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +//array of values to iterate over +$values = array( + + // float data + 10.5, + -10.5, + 10.1234567e10, + 10.7654321E-10, + .5, + + // array data + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new aClass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for code + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( xml_error_string($value) ); +}; + +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_error_string() : usage variations *** + +Arg value 10.5 +string(22) "XML_ERR_CHARREF_AT_EOF" + +Arg value -10.5 +string(7) "Unknown" + +Arg value 101234567000 +string(7) "Unknown" + +Arg value 1.07654321E-9 +string(8) "No error" + +Arg value 0.5 +string(8) "No error" + +Arg value Array + +Warning: xml_error_string() expects parameter 1 to be long, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_error_string() expects parameter 1 to be long, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_error_string() expects parameter 1 to be long, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_error_string() expects parameter 1 to be long, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_error_string() expects parameter 1 to be long, array given in %s on line %d +NULL + +Arg value +string(8) "No error" + +Arg value +string(8) "No error" + +Arg value 1 +string(14) "Internal error" + +Arg value +string(8) "No error" + +Arg value 1 +string(14) "Internal error" + +Arg value +string(8) "No error" + +Arg value + +Warning: xml_error_string() expects parameter 1 to be long, string given in %s on line %d +NULL + +Arg value + +Warning: xml_error_string() expects parameter 1 to be long, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_error_string() expects parameter 1 to be long, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_error_string() expects parameter 1 to be long, string given in %s on line %d +NULL + +Arg value Some Ascii Data + +Warning: xml_error_string() expects parameter 1 to be long, object given in %s on line %d +NULL + +Arg value +string(8) "No error" + +Arg value +string(8) "No error" +Done + + diff --git a/ext/xml/tests/xml_get_current_byte_index_error.phpt b/ext/xml/tests/xml_get_current_byte_index_error.phpt new file mode 100644 index 0000000000..6949dd3f29 --- /dev/null +++ b/ext/xml/tests/xml_get_current_byte_index_error.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test xml_get_current_byte_index() function : error conditions +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_get_current_byte_index(resource parser) + * Description: Get current byte index for an XML parser + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +/* + * add a comment here to say what the test is supposed to do + */ + +echo "*** Testing xml_get_current_byte_index() : error conditions ***\n"; + +// Zero arguments +echo "\n-- Testing xml_get_current_byte_index() function with Zero arguments --\n"; +var_dump( xml_get_current_byte_index() ); + +//Test xml_get_current_byte_index with one more than the expected number of arguments +echo "\n-- Testing xml_get_current_byte_index() function with more than expected no. of arguments --\n"; + +$extra_arg = 10; +var_dump( xml_get_current_byte_index(null, $extra_arg) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_get_current_byte_index() : error conditions *** + +-- Testing xml_get_current_byte_index() function with Zero arguments -- + +Warning: xml_get_current_byte_index() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing xml_get_current_byte_index() function with more than expected no. of arguments -- + +Warning: xml_get_current_byte_index() expects exactly 1 parameter, 2 given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_get_current_byte_index_variation1.phpt b/ext/xml/tests/xml_get_current_byte_index_variation1.phpt new file mode 100644 index 0000000000..7f57ee3297 --- /dev/null +++ b/ext/xml/tests/xml_get_current_byte_index_variation1.phpt @@ -0,0 +1,240 @@ +--TEST-- +Test xml_get_current_byte_index() function : usage variations - <type here specifics of this variation> +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_get_current_byte_index(resource parser) + * Description: Get current byte index for an XML parser + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_get_current_byte_index() : usage variations ***\n"; +error_reporting(E_ALL & ~E_NOTICE); + +class aClass { + function __toString() { + return "Some Ascii Data"; + } +} +// Initialise function arguments not being substituted (if any) + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +$fp = fopen(__FILE__, "r"); + +//array of values to iterate over +$values = array( + + // int data + 0, + 1, + 12345, + -2345, + + // float data + 10.5, + -10.5, + 10.1234567e10, + 10.7654321E-10, + .5, + + // array data + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new aClass(), + + // resource data + $fp, + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for parser + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( xml_get_current_byte_index($value) ); +}; + +fclose($fp); +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_get_current_byte_index() : usage variations *** + +Arg value 0 + +Warning: xml_get_current_byte_index() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_get_current_byte_index() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 12345 + +Warning: xml_get_current_byte_index() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value -2345 + +Warning: xml_get_current_byte_index() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 10.5 + +Warning: xml_get_current_byte_index() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value -10.5 + +Warning: xml_get_current_byte_index() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 101234567000 + +Warning: xml_get_current_byte_index() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 1.07654321E-9 + +Warning: xml_get_current_byte_index() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 0.5 + +Warning: xml_get_current_byte_index() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value Array + +Warning: xml_get_current_byte_index() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_get_current_byte_index() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_get_current_byte_index() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_get_current_byte_index() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_get_current_byte_index() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value + +Warning: xml_get_current_byte_index() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_get_current_byte_index() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_get_current_byte_index() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_get_current_byte_index() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_get_current_byte_index() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_get_current_byte_index() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_get_current_byte_index() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value + +Warning: xml_get_current_byte_index() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_get_current_byte_index() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_get_current_byte_index() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value Some Ascii Data + +Warning: xml_get_current_byte_index() expects parameter 1 to be resource, object given in %s on line %d +NULL + +Arg value Resource id %s + +Warning: xml_get_current_byte_index(): supplied resource is not a valid XML Parser resource in %s on line %d +bool(false) + +Arg value + +Warning: xml_get_current_byte_index() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_get_current_byte_index() expects parameter 1 to be resource, null given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_get_current_column_number_error.phpt b/ext/xml/tests/xml_get_current_column_number_error.phpt new file mode 100644 index 0000000000..21f470ec24 --- /dev/null +++ b/ext/xml/tests/xml_get_current_column_number_error.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test xml_get_current_column_number() function : error conditions +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_get_current_column_number(resource parser) + * Description: Get current column number for an XML parser + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +/* + * add a comment here to say what the test is supposed to do + */ + +echo "*** Testing xml_get_current_column_number() : error conditions ***\n"; + +// Zero arguments +echo "\n-- Testing xml_get_current_column_number() function with Zero arguments --\n"; +var_dump( xml_get_current_column_number() ); + +//Test xml_get_current_column_number with one more than the expected number of arguments +echo "\n-- Testing xml_get_current_column_number() function with more than expected no. of arguments --\n"; + +$extra_arg = 10; +var_dump( xml_get_current_column_number(null, $extra_arg) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_get_current_column_number() : error conditions *** + +-- Testing xml_get_current_column_number() function with Zero arguments -- + +Warning: xml_get_current_column_number() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing xml_get_current_column_number() function with more than expected no. of arguments -- + +Warning: xml_get_current_column_number() expects exactly 1 parameter, 2 given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_get_current_column_number_variation1.phpt b/ext/xml/tests/xml_get_current_column_number_variation1.phpt new file mode 100644 index 0000000000..59db610291 --- /dev/null +++ b/ext/xml/tests/xml_get_current_column_number_variation1.phpt @@ -0,0 +1,241 @@ +--TEST-- +Test xml_get_current_column_number() function : usage variations +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_get_current_column_number(resource parser) + * Description: Get current column number for an XML parser + * Source code: ext/xml/xml.c + * Alias to functions: + */ + + +echo "*** Testing xml_get_current_column_number() : usage variations ***\n"; +error_reporting(E_ALL & ~E_NOTICE); + +class aClass { + function __toString() { + return "Some Ascii Data"; + } +} +// Initialise function arguments not being substituted (if any) + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +$fp = fopen(__FILE__, "r"); + +//array of values to iterate over +$values = array( + + // int data + 0, + 1, + 12345, + -2345, + + // float data + 10.5, + -10.5, + 10.1234567e10, + 10.7654321E-10, + .5, + + // array data + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new aClass(), + + // resource data + $fp, + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for parser + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( xml_get_current_column_number($value) ); +}; + +fclose($fp); +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_get_current_column_number() : usage variations *** + +Arg value 0 + +Warning: xml_get_current_column_number() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_get_current_column_number() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 12345 + +Warning: xml_get_current_column_number() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value -2345 + +Warning: xml_get_current_column_number() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 10.5 + +Warning: xml_get_current_column_number() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value -10.5 + +Warning: xml_get_current_column_number() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 101234567000 + +Warning: xml_get_current_column_number() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 1.07654321E-9 + +Warning: xml_get_current_column_number() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 0.5 + +Warning: xml_get_current_column_number() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value Array + +Warning: xml_get_current_column_number() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_get_current_column_number() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_get_current_column_number() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_get_current_column_number() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_get_current_column_number() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value + +Warning: xml_get_current_column_number() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_get_current_column_number() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_get_current_column_number() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_get_current_column_number() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_get_current_column_number() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_get_current_column_number() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_get_current_column_number() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value + +Warning: xml_get_current_column_number() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_get_current_column_number() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_get_current_column_number() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value Some Ascii Data + +Warning: xml_get_current_column_number() expects parameter 1 to be resource, object given in %s on line %d +NULL + +Arg value Resource id %s + +Warning: xml_get_current_column_number(): supplied resource is not a valid XML Parser resource in %s on line %d +bool(false) + +Arg value + +Warning: xml_get_current_column_number() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_get_current_column_number() expects parameter 1 to be resource, null given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_get_current_line_number_error.phpt b/ext/xml/tests/xml_get_current_line_number_error.phpt new file mode 100644 index 0000000000..9e3c4a40a1 --- /dev/null +++ b/ext/xml/tests/xml_get_current_line_number_error.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test xml_get_current_line_number() function : error conditions +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_get_current_line_number(resource parser) + * Description: Get current line number for an XML parser + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +/* + * add a comment here to say what the test is supposed to do + */ + +echo "*** Testing xml_get_current_line_number() : error conditions ***\n"; + +// Zero arguments +echo "\n-- Testing xml_get_current_line_number() function with Zero arguments --\n"; +var_dump( xml_get_current_line_number() ); + +//Test xml_get_current_line_number with one more than the expected number of arguments +echo "\n-- Testing xml_get_current_line_number() function with more than expected no. of arguments --\n"; + +$extra_arg = 10; +var_dump( xml_get_current_line_number(null, $extra_arg) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_get_current_line_number() : error conditions *** + +-- Testing xml_get_current_line_number() function with Zero arguments -- + +Warning: xml_get_current_line_number() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing xml_get_current_line_number() function with more than expected no. of arguments -- + +Warning: xml_get_current_line_number() expects exactly 1 parameter, 2 given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_get_current_line_number_variation1.phpt b/ext/xml/tests/xml_get_current_line_number_variation1.phpt new file mode 100644 index 0000000000..0878dbb736 --- /dev/null +++ b/ext/xml/tests/xml_get_current_line_number_variation1.phpt @@ -0,0 +1,240 @@ +--TEST-- +Test xml_get_current_line_number() function : usage variations +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_get_current_line_number(resource parser) + * Description: Get current line number for an XML parser + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_get_current_line_number() : usage variations ***\n"; +error_reporting(E_ALL & ~E_NOTICE); + +class aClass { + function __toString() { + return "Some Ascii Data"; + } +} +// Initialise function arguments not being substituted (if any) + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +$fp = fopen(__FILE__, "r"); + +//array of values to iterate over +$values = array( + + // int data + 0, + 1, + 12345, + -2345, + + // float data + 10.5, + -10.5, + 10.1234567e10, + 10.7654321E-10, + .5, + + // array data + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new aClass(), + + // resource data + $fp, + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for parser + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( xml_get_current_line_number($value) ); +}; + +fclose($fp); +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_get_current_line_number() : usage variations *** + +Arg value 0 + +Warning: xml_get_current_line_number() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_get_current_line_number() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 12345 + +Warning: xml_get_current_line_number() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value -2345 + +Warning: xml_get_current_line_number() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 10.5 + +Warning: xml_get_current_line_number() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value -10.5 + +Warning: xml_get_current_line_number() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 101234567000 + +Warning: xml_get_current_line_number() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 1.07654321E-9 + +Warning: xml_get_current_line_number() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 0.5 + +Warning: xml_get_current_line_number() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value Array + +Warning: xml_get_current_line_number() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_get_current_line_number() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_get_current_line_number() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_get_current_line_number() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_get_current_line_number() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value + +Warning: xml_get_current_line_number() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_get_current_line_number() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_get_current_line_number() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_get_current_line_number() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_get_current_line_number() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_get_current_line_number() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_get_current_line_number() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value + +Warning: xml_get_current_line_number() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_get_current_line_number() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_get_current_line_number() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value Some Ascii Data + +Warning: xml_get_current_line_number() expects parameter 1 to be resource, object given in %s on line %d +NULL + +Arg value Resource id %s + +Warning: xml_get_current_line_number(): supplied resource is not a valid XML Parser resource in %s on line %d +bool(false) + +Arg value + +Warning: xml_get_current_line_number() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_get_current_line_number() expects parameter 1 to be resource, null given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_get_error_code_error.phpt b/ext/xml/tests/xml_get_error_code_error.phpt new file mode 100644 index 0000000000..683734ae34 --- /dev/null +++ b/ext/xml/tests/xml_get_error_code_error.phpt @@ -0,0 +1,44 @@ +--TEST-- +Test xml_get_error_code() function : error conditions +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_get_error_code(resource parser) + * Description: Get XML parser error code + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_get_error_code() : error conditions ***\n"; + +// Zero arguments +echo "\n-- Testing xml_get_error_code() function with Zero arguments --\n"; +var_dump( xml_get_error_code() ); + +//Test xml_get_error_code with one more than the expected number of arguments +echo "\n-- Testing xml_get_error_code() function with more than expected no. of arguments --\n"; + +$extra_arg = 10; +var_dump( xml_get_error_code(null, $extra_arg) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_get_error_code() : error conditions *** + +-- Testing xml_get_error_code() function with Zero arguments -- + +Warning: xml_get_error_code() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing xml_get_error_code() function with more than expected no. of arguments -- + +Warning: xml_get_error_code() expects exactly 1 parameter, 2 given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_get_error_code_variation1.phpt b/ext/xml/tests/xml_get_error_code_variation1.phpt new file mode 100644 index 0000000000..32caa52b5f --- /dev/null +++ b/ext/xml/tests/xml_get_error_code_variation1.phpt @@ -0,0 +1,240 @@ +--TEST-- +Test xml_get_error_code() function : usage variations +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_get_error_code(resource parser) + * Description: Get XML parser error code + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_get_error_code() : usage variations ***\n"; +error_reporting(E_ALL & ~E_NOTICE); + +class aClass { + function __toString() { + return "Some Ascii Data"; + } +} +// Initialise function arguments not being substituted (if any) + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +$fp = fopen(__FILE__, "r"); + +//array of values to iterate over +$values = array( + + // int data + 0, + 1, + 12345, + -2345, + + // float data + 10.5, + -10.5, + 10.1234567e10, + 10.7654321E-10, + .5, + + // array data + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new aClass(), + + // resource data + $fp, + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for parser + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( xml_get_error_code($value) ); +}; + +fclose($fp); +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_get_error_code() : usage variations *** + +Arg value 0 + +Warning: xml_get_error_code() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_get_error_code() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 12345 + +Warning: xml_get_error_code() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value -2345 + +Warning: xml_get_error_code() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 10.5 + +Warning: xml_get_error_code() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value -10.5 + +Warning: xml_get_error_code() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 101234567000 + +Warning: xml_get_error_code() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 1.07654321E-9 + +Warning: xml_get_error_code() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 0.5 + +Warning: xml_get_error_code() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value Array + +Warning: xml_get_error_code() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_get_error_code() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_get_error_code() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_get_error_code() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_get_error_code() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value + +Warning: xml_get_error_code() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_get_error_code() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_get_error_code() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_get_error_code() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_get_error_code() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_get_error_code() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_get_error_code() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value + +Warning: xml_get_error_code() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_get_error_code() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_get_error_code() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value Some Ascii Data + +Warning: xml_get_error_code() expects parameter 1 to be resource, object given in %s on line %d +NULL + +Arg value Resource id %s + +Warning: xml_get_error_code(): supplied resource is not a valid XML Parser resource in %s on line %d +bool(false) + +Arg value + +Warning: xml_get_error_code() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_get_error_code() expects parameter 1 to be resource, null given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_parse_error.phpt b/ext/xml/tests/xml_parse_error.phpt new file mode 100644 index 0000000000..d8d8fffa80 --- /dev/null +++ b/ext/xml/tests/xml_parse_error.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test xml_parse() function : error conditions +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_parse(resource parser, string data [, int isFinal]) + * Description: Start parsing an XML document + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_parse() : error conditions ***\n"; + + +//Test xml_parse with one more than the expected number of arguments +echo "\n-- Testing xml_parse() function with more than expected no. of arguments --\n"; + +$data = 'string_val'; +$isFinal = false; +$extra_arg = 10; +var_dump( xml_parse(null, $data, $isFinal, $extra_arg) ); + +// Testing xml_parse with one less than the expected number of arguments +echo "\n-- Testing xml_parse() function with less than expected no. of arguments --\n"; + +var_dump( xml_parse(null) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_parse() : error conditions *** + +-- Testing xml_parse() function with more than expected no. of arguments -- + +Warning: xml_parse() expects at most 3 parameters, 4 given in %s on line %d +NULL + +-- Testing xml_parse() function with less than expected no. of arguments -- + +Warning: xml_parse() expects at least 2 parameters, 1 given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_parse_into_struct_error.phpt b/ext/xml/tests/xml_parse_into_struct_error.phpt new file mode 100644 index 0000000000..82a26ad05e --- /dev/null +++ b/ext/xml/tests/xml_parse_into_struct_error.phpt @@ -0,0 +1,49 @@ +--TEST-- +Test xml_parse_into_struct() function : error conditions +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_parse_into_struct(resource parser, string data, array &struct, array &index) + * Description: Parsing a XML document + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_parse_into_struct() : error conditions ***\n"; + +//Test xml_parse_into_struct with one more than the expected number of arguments +echo "\n-- Testing xml_parse_into_struct() function with more than expected no. of arguments --\n"; + +$data = 'string_val'; +$struct = array(1, 2); +$index = array(1, 2); +$extra_arg = 10; +var_dump( xml_parse_into_struct(null, $data, $struct, $index, $extra_arg) ); + +// Testing xml_parse_into_struct with one less than the expected number of arguments +echo "\n-- Testing xml_parse_into_struct() function with less than expected no. of arguments --\n"; + +$data = 'string_val'; +var_dump( xml_parse_into_struct(null, $data) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_parse_into_struct() : error conditions *** + +-- Testing xml_parse_into_struct() function with more than expected no. of arguments -- + +Warning: xml_parse_into_struct() expects at most 4 parameters, 5 given in %s on line %d +NULL + +-- Testing xml_parse_into_struct() function with less than expected no. of arguments -- + +Warning: xml_parse_into_struct() expects at least 3 parameters, 2 given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_parse_into_struct_variation.phpt b/ext/xml/tests/xml_parse_into_struct_variation.phpt new file mode 100644 index 0000000000..e82abdff93 --- /dev/null +++ b/ext/xml/tests/xml_parse_into_struct_variation.phpt @@ -0,0 +1,125 @@ +--TEST-- +Test xml_parse_into_struct() function : variation +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_parse_into_struct(resource parser, string data, array &struct, array &index) + * Description: Parsing a XML document + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +/* + * add a comment here to say what the test is supposed to do + */ + +echo "*** Testing xml_parse_into_struct() : variation ***\n"; + + +$simple = "<main><para><note>simple note</note></para><para><note>simple note</note></para></main>"; +$p = xml_parser_create(); +xml_parse_into_struct($p, $simple, $vals, $index); +xml_parser_free($p); +echo "Index array\n"; +print_r($index); +echo "\nVals array\n"; +print_r($vals); + + +echo "Done"; +?> +--EXPECT-- +*** Testing xml_parse_into_struct() : variation *** +Index array +Array +( + [MAIN] => Array + ( + [0] => 0 + [1] => 7 + ) + + [PARA] => Array + ( + [0] => 1 + [1] => 3 + [2] => 4 + [3] => 6 + ) + + [NOTE] => Array + ( + [0] => 2 + [1] => 5 + ) + +) + +Vals array +Array +( + [0] => Array + ( + [tag] => MAIN + [type] => open + [level] => 1 + ) + + [1] => Array + ( + [tag] => PARA + [type] => open + [level] => 2 + ) + + [2] => Array + ( + [tag] => NOTE + [type] => complete + [level] => 3 + [value] => simple note + ) + + [3] => Array + ( + [tag] => PARA + [type] => close + [level] => 2 + ) + + [4] => Array + ( + [tag] => PARA + [type] => open + [level] => 2 + ) + + [5] => Array + ( + [tag] => NOTE + [type] => complete + [level] => 3 + [value] => simple note + ) + + [6] => Array + ( + [tag] => PARA + [type] => close + [level] => 2 + ) + + [7] => Array + ( + [tag] => MAIN + [type] => close + [level] => 1 + ) + +) +Done
\ No newline at end of file diff --git a/ext/xml/tests/xml_parse_into_struct_variation1.phpt b/ext/xml/tests/xml_parse_into_struct_variation1.phpt new file mode 100644 index 0000000000..78b0cf43cd --- /dev/null +++ b/ext/xml/tests/xml_parse_into_struct_variation1.phpt @@ -0,0 +1,241 @@ +--TEST-- +Test xml_parse_into_struct() function : usage variations - different types for parser +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_parse_into_struct(resource parser, string data, array &struct, array &index) + * Description: Parsing a XML document + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_parse_into_struct() : usage variations ***\n"; +error_reporting(E_ALL & ~E_NOTICE); + +class aClass { + function __toString() { + return "Some Ascii Data"; + } +} +// Initialise function arguments not being substituted (if any) +$data = 'string_val'; + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +$fp = fopen(__FILE__, "r"); + +//array of values to iterate over +$values = array( + + // int data + 0, + 1, + 12345, + -2345, + + // float data + 10.5, + -10.5, + 10.1234567e10, + 10.7654321E-10, + .5, + + // array data + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new aClass(), + + // resource data + $fp, + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for parser + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( xml_parse_into_struct($value, $data, $struct, $index) ); +}; + +fclose($fp); +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_parse_into_struct() : usage variations *** + +Arg value 0 + +Warning: xml_parse_into_struct() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_parse_into_struct() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 12345 + +Warning: xml_parse_into_struct() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value -2345 + +Warning: xml_parse_into_struct() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 10.5 + +Warning: xml_parse_into_struct() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value -10.5 + +Warning: xml_parse_into_struct() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 101234567000 + +Warning: xml_parse_into_struct() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 1.07654321E-9 + +Warning: xml_parse_into_struct() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 0.5 + +Warning: xml_parse_into_struct() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value Array + +Warning: xml_parse_into_struct() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_parse_into_struct() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_parse_into_struct() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_parse_into_struct() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_parse_into_struct() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value + +Warning: xml_parse_into_struct() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_parse_into_struct() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_parse_into_struct() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_parse_into_struct() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_parse_into_struct() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_parse_into_struct() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_parse_into_struct() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value + +Warning: xml_parse_into_struct() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_parse_into_struct() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_parse_into_struct() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value Some Ascii Data + +Warning: xml_parse_into_struct() expects parameter 1 to be resource, object given in %s on line %d +NULL + +Arg value Resource id %s + +Warning: xml_parse_into_struct(): supplied resource is not a valid XML Parser resource in %s on line %d +bool(false) + +Arg value + +Warning: xml_parse_into_struct() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_parse_into_struct() expects parameter 1 to be resource, null given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_parse_variation1.phpt b/ext/xml/tests/xml_parse_variation1.phpt new file mode 100644 index 0000000000..23f199a4dc --- /dev/null +++ b/ext/xml/tests/xml_parse_variation1.phpt @@ -0,0 +1,242 @@ +--TEST-- +Test xml_parse() function : usage variations - different types of parser +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_parse(resource parser, string data [, int isFinal]) + * Description: Start parsing an XML document + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_parse() : usage variations ***\n"; +error_reporting(E_ALL & ~E_NOTICE); + +class aClass { + function __toString() { + return "Some Ascii Data"; + } +} +// Initialise function arguments not being substituted (if any) +$data = 'string_val'; +$isFinal = 10; + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +$fp = fopen(__FILE__, "r"); + +//array of values to iterate over +$values = array( + + // int data + 0, + 1, + 12345, + -2345, + + // float data + 10.5, + -10.5, + 10.1234567e10, + 10.7654321E-10, + .5, + + // array data + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new aClass(), + + // resource data + $fp, + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for parser + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( xml_parse($value, $data, $isFinal) ); +}; + +fclose($fp); +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_parse() : usage variations *** + +Arg value 0 + +Warning: xml_parse() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_parse() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 12345 + +Warning: xml_parse() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value -2345 + +Warning: xml_parse() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 10.5 + +Warning: xml_parse() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value -10.5 + +Warning: xml_parse() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 101234567000 + +Warning: xml_parse() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 1.07654321E-9 + +Warning: xml_parse() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 0.5 + +Warning: xml_parse() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value Array + +Warning: xml_parse() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_parse() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_parse() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_parse() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_parse() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value + +Warning: xml_parse() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_parse() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_parse() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_parse() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_parse() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_parse() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_parse() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value + +Warning: xml_parse() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_parse() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_parse() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value Some Ascii Data + +Warning: xml_parse() expects parameter 1 to be resource, object given in %s on line %d +NULL + +Arg value Resource id %s + +Warning: xml_parse(): supplied resource is not a valid XML Parser resource in %s on line %d +bool(false) + +Arg value + +Warning: xml_parse() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_parse() expects parameter 1 to be resource, null given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_parser_create_error.phpt b/ext/xml/tests/xml_parser_create_error.phpt new file mode 100644 index 0000000000..571350e873 --- /dev/null +++ b/ext/xml/tests/xml_parser_create_error.phpt @@ -0,0 +1,35 @@ +--TEST-- +Test xml_parser_create() function : error conditions +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto resource xml_parser_create([string encoding]) + * Description: Create an XML parser + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_parser_create() : error conditions ***\n"; + + +//Test xml_parser_create with one more than the expected number of arguments +echo "\n-- Testing xml_parser_create() function with more than expected no. of arguments --\n"; +$encoding = 'utf-8'; +$extra_arg = 10; +var_dump( xml_parser_create($encoding, $extra_arg) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_parser_create() : error conditions *** + +-- Testing xml_parser_create() function with more than expected no. of arguments -- + +Warning: xml_parser_create() expects at most 1 parameter, 2 given in %s on line %d +bool(false) +Done diff --git a/ext/xml/tests/xml_parser_create_ns_error.phpt b/ext/xml/tests/xml_parser_create_ns_error.phpt new file mode 100644 index 0000000000..fd50f29488 --- /dev/null +++ b/ext/xml/tests/xml_parser_create_ns_error.phpt @@ -0,0 +1,36 @@ +--TEST-- +Test xml_parser_create_ns() function : error conditions +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto resource xml_parser_create_ns([string encoding [, string sep]]) + * Description: Create an XML parser + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_parser_create_ns() : error conditions ***\n"; + + +//Test xml_parser_create_ns with one more than the expected number of arguments +echo "\n-- Testing xml_parser_create_ns() function with more than expected no. of arguments --\n"; +$encoding = 'string_val'; +$sep = 'string_val'; +$extra_arg = 10; +var_dump( xml_parser_create_ns($encoding, $sep, $extra_arg) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_parser_create_ns() : error conditions *** + +-- Testing xml_parser_create_ns() function with more than expected no. of arguments -- + +Warning: xml_parser_create_ns() expects at most 2 parameters, 3 given in %s on line %d +bool(false) +Done
\ No newline at end of file diff --git a/ext/xml/tests/xml_parser_create_ns_variation1.phpt b/ext/xml/tests/xml_parser_create_ns_variation1.phpt new file mode 100644 index 0000000000..5446a4f3ee --- /dev/null +++ b/ext/xml/tests/xml_parser_create_ns_variation1.phpt @@ -0,0 +1,245 @@ +--TEST-- +Test xml_parser_create_ns() function : usage variations +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto resource xml_parser_create_ns([string encoding [, string sep]]) + * Description: Create an XML parser + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_parser_create_ns() : usage variations ***\n"; +error_reporting(E_ALL & ~E_NOTICE); + +class aClass { + function __toString() { + return "Some Ascii Data"; + } +} +// Initialise function arguments not being substituted (if any) + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +$fp = fopen(__FILE__, "r"); + +//array of values to iterate over +$values = array( + + // int data + 0, + 1, + 12345, + -2345, + + // float data + 10.5, + -10.5, + 10.1234567e10, + 10.7654321E-10, + .5, + + // array data + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + "ISO-8859-1", + "UTF-8", + "US-ASCII", + "UTF-32", + + // object data + new aClass(), + + // resource data + $fp, + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for encoding + +foreach($values as $value) { + echo "\nArg value $value \n"; + $res = xml_parser_create_ns($value); + var_dump($res); + if ($res !== false) { + xml_parser_free($res); + } +}; + +fclose($fp); +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_parser_create_ns() : usage variations *** + +Arg value 0 + +Warning: xml_parser_create_ns(): unsupported source encoding "0" in %s on line %d +bool(false) + +Arg value 1 + +Warning: xml_parser_create_ns(): unsupported source encoding "1" in %s on line %d +bool(false) + +Arg value 12345 + +Warning: xml_parser_create_ns(): unsupported source encoding "12345" in %s on line %d +bool(false) + +Arg value -2345 + +Warning: xml_parser_create_ns(): unsupported source encoding "-2345" in %s on line %d +bool(false) + +Arg value 10.5 + +Warning: xml_parser_create_ns(): unsupported source encoding "10.5" in %s on line %d +bool(false) + +Arg value -10.5 + +Warning: xml_parser_create_ns(): unsupported source encoding "-10.5" in %s on line %d +bool(false) + +Arg value 101234567000 + +Warning: xml_parser_create_ns(): unsupported source encoding "101234567000" in %s on line %d +bool(false) + +Arg value 1.07654321E-9 + +Warning: xml_parser_create_ns(): unsupported source encoding "1.07654321E-9" in %s on line %d +bool(false) + +Arg value 0.5 + +Warning: xml_parser_create_ns(): unsupported source encoding "0.5" in %s on line %d +bool(false) + +Arg value Array + +Warning: xml_parser_create_ns() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +Arg value Array + +Warning: xml_parser_create_ns() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +Arg value Array + +Warning: xml_parser_create_ns() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +Arg value Array + +Warning: xml_parser_create_ns() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +Arg value Array + +Warning: xml_parser_create_ns() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +Arg value +resource(%d) of type (xml) + +Arg value +resource(%d) of type (xml) + +Arg value 1 + +Warning: xml_parser_create_ns(): unsupported source encoding "1" in %s on line %d +bool(false) + +Arg value +resource(%d) of type (xml) + +Arg value 1 + +Warning: xml_parser_create_ns(): unsupported source encoding "1" in %s on line %d +bool(false) + +Arg value +resource(%d) of type (xml) + +Arg value +resource(%d) of type (xml) + +Arg value +resource(%d) of type (xml) + +Arg value string + +Warning: xml_parser_create_ns(): unsupported source encoding "string" in %s on line %d +bool(false) + +Arg value string + +Warning: xml_parser_create_ns(): unsupported source encoding "string" in %s on line %d +bool(false) + +Arg value ISO-8859-1 +resource(%d) of type (xml) + +Arg value UTF-8 +resource(%d) of type (xml) + +Arg value US-ASCII +resource(%d) of type (xml) + +Arg value UTF-32 + +Warning: xml_parser_create_ns(): unsupported source encoding "UTF-32" in %s on line %d +bool(false) + +Arg value Some Ascii Data + +Warning: xml_parser_create_ns(): unsupported source encoding "Some Ascii Data" in %s on line %d +bool(false) + +Arg value Resource id %s + +Warning: xml_parser_create_ns() expects parameter 1 to be string, resource given in %s on line %d +bool(false) + +Arg value +resource(%d) of type (xml) + +Arg value +resource(%d) of type (xml) +Done diff --git a/ext/xml/tests/xml_parser_create_variation1.phpt b/ext/xml/tests/xml_parser_create_variation1.phpt new file mode 100644 index 0000000000..445b40d08e --- /dev/null +++ b/ext/xml/tests/xml_parser_create_variation1.phpt @@ -0,0 +1,245 @@ +--TEST-- +Test xml_parser_create() function : usage variations +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto resource xml_parser_create([string encoding]) + * Description: Create an XML parser + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_parser_create() : usage variations ***\n"; +error_reporting(E_ALL & ~E_NOTICE); + +class aClass { + function __toString() { + return "Some Ascii Data"; + } +} +// Initialise function arguments not being substituted (if any) + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +$fp = fopen(__FILE__, "r"); + +//array of values to iterate over +$values = array( + + // int data + 0, + 1, + 12345, + -2345, + + // float data + 10.5, + -10.5, + 10.1234567e10, + 10.7654321E-10, + .5, + + // array data + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + "ISO-8859-1", + "UTF-8", + "US-ASCII", + "UTF-32", + + // object data + new aClass(), + + // resource data + $fp, + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for encoding + +foreach($values as $value) { + echo "\nArg value $value \n"; + $res = xml_parser_create($value); + var_dump($res); + if ($res !== false) { + xml_parser_free($res); + } +}; + +fclose($fp); +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_parser_create() : usage variations *** + +Arg value 0 + +Warning: xml_parser_create(): unsupported source encoding "0" in %s on line %d +bool(false) + +Arg value 1 + +Warning: xml_parser_create(): unsupported source encoding "1" in %s on line %d +bool(false) + +Arg value 12345 + +Warning: xml_parser_create(): unsupported source encoding "12345" in %s on line %d +bool(false) + +Arg value -2345 + +Warning: xml_parser_create(): unsupported source encoding "-2345" in %s on line %d +bool(false) + +Arg value 10.5 + +Warning: xml_parser_create(): unsupported source encoding "10.5" in %s on line %d +bool(false) + +Arg value -10.5 + +Warning: xml_parser_create(): unsupported source encoding "-10.5" in %s on line %d +bool(false) + +Arg value 101234567000 + +Warning: xml_parser_create(): unsupported source encoding "101234567000" in %s on line %d +bool(false) + +Arg value 1.07654321E-9 + +Warning: xml_parser_create(): unsupported source encoding "1.07654321E-9" in %s on line %d +bool(false) + +Arg value 0.5 + +Warning: xml_parser_create(): unsupported source encoding "0.5" in %s on line %d +bool(false) + +Arg value Array + +Warning: xml_parser_create() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +Arg value Array + +Warning: xml_parser_create() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +Arg value Array + +Warning: xml_parser_create() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +Arg value Array + +Warning: xml_parser_create() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +Arg value Array + +Warning: xml_parser_create() expects parameter 1 to be string, array given in %s on line %d +bool(false) + +Arg value +resource(%d) of type (xml) + +Arg value +resource(%d) of type (xml) + +Arg value 1 + +Warning: xml_parser_create(): unsupported source encoding "1" in %s on line %d +bool(false) + +Arg value +resource(%d) of type (xml) + +Arg value 1 + +Warning: xml_parser_create(): unsupported source encoding "1" in %s on line %d +bool(false) + +Arg value +resource(%d) of type (xml) + +Arg value +resource(%d) of type (xml) + +Arg value +resource(%d) of type (xml) + +Arg value string + +Warning: xml_parser_create(): unsupported source encoding "string" in %s on line %d +bool(false) + +Arg value string + +Warning: xml_parser_create(): unsupported source encoding "string" in %s on line %d +bool(false) + +Arg value ISO-8859-1 +resource(%d) of type (xml) + +Arg value UTF-8 +resource(%d) of type (xml) + +Arg value US-ASCII +resource(%d) of type (xml) + +Arg value UTF-32 + +Warning: xml_parser_create(): unsupported source encoding "UTF-32" in %s on line %d +bool(false) + +Arg value Some Ascii Data + +Warning: xml_parser_create(): unsupported source encoding "Some Ascii Data" in %s on line %d +bool(false) + +Arg value Resource id %s + +Warning: xml_parser_create() expects parameter 1 to be string, resource given in %s on line %d +bool(false) + +Arg value +resource(%d) of type (xml) + +Arg value +resource(%d) of type (xml) +Done
\ No newline at end of file diff --git a/ext/xml/tests/xml_parser_free_error.phpt b/ext/xml/tests/xml_parser_free_error.phpt new file mode 100644 index 0000000000..13afb95a71 --- /dev/null +++ b/ext/xml/tests/xml_parser_free_error.phpt @@ -0,0 +1,44 @@ +--TEST-- +Test xml_parser_free() function : error conditions +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_parser_free(resource parser) + * Description: Free an XML parser + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_parser_free() : error conditions ***\n"; + +// Zero arguments +echo "\n-- Testing xml_parser_free() function with Zero arguments --\n"; +var_dump( xml_parser_free() ); + +//Test xml_parser_free with one more than the expected number of arguments +echo "\n-- Testing xml_parser_free() function with more than expected no. of arguments --\n"; + +$extra_arg = 10; +var_dump( xml_parser_free(null, $extra_arg) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_parser_free() : error conditions *** + +-- Testing xml_parser_free() function with Zero arguments -- + +Warning: xml_parser_free() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +-- Testing xml_parser_free() function with more than expected no. of arguments -- + +Warning: xml_parser_free() expects exactly 1 parameter, 2 given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_parser_free_variation1.phpt b/ext/xml/tests/xml_parser_free_variation1.phpt new file mode 100644 index 0000000000..4b4de5d05b --- /dev/null +++ b/ext/xml/tests/xml_parser_free_variation1.phpt @@ -0,0 +1,240 @@ +--TEST-- +Test xml_parser_free() function : usage variations +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_parser_free(resource parser) + * Description: Free an XML parser + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_parser_free() : usage variations ***\n"; +error_reporting(E_ALL & ~E_NOTICE); + +class aClass { + function __toString() { + return "Some Ascii Data"; + } +} +// Initialise function arguments not being substituted (if any) + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +$fp = fopen(__FILE__, "r"); + +//array of values to iterate over +$values = array( + + // int data + 0, + 1, + 12345, + -2345, + + // float data + 10.5, + -10.5, + 10.1234567e10, + 10.7654321E-10, + .5, + + // array data + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new aClass(), + + // resource data + $fp, + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for parser + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( xml_parser_free($value) ); +}; + +fclose($fp); +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_parser_free() : usage variations *** + +Arg value 0 + +Warning: xml_parser_free() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_parser_free() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 12345 + +Warning: xml_parser_free() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value -2345 + +Warning: xml_parser_free() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 10.5 + +Warning: xml_parser_free() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value -10.5 + +Warning: xml_parser_free() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 101234567000 + +Warning: xml_parser_free() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 1.07654321E-9 + +Warning: xml_parser_free() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 0.5 + +Warning: xml_parser_free() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value Array + +Warning: xml_parser_free() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_parser_free() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_parser_free() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_parser_free() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_parser_free() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value + +Warning: xml_parser_free() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_parser_free() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_parser_free() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_parser_free() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_parser_free() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_parser_free() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_parser_free() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value + +Warning: xml_parser_free() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_parser_free() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_parser_free() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value Some Ascii Data + +Warning: xml_parser_free() expects parameter 1 to be resource, object given in %s on line %d +NULL + +Arg value Resource id %s + +Warning: xml_parser_free(): supplied resource is not a valid XML Parser resource in %s on line %d +bool(false) + +Arg value + +Warning: xml_parser_free() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_parser_free() expects parameter 1 to be resource, null given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_parser_get_option_error.phpt b/ext/xml/tests/xml_parser_get_option_error.phpt new file mode 100644 index 0000000000..a35536934c --- /dev/null +++ b/ext/xml/tests/xml_parser_get_option_error.phpt @@ -0,0 +1,46 @@ +--TEST-- +Test xml_parser_get_option() function : error conditions +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_parser_get_option(resource parser, int option) + * Description: Get options from an XML parser + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_parser_get_option() : error conditions ***\n"; + + +//Test xml_parser_get_option with one more than the expected number of arguments +echo "\n-- Testing xml_parser_get_option() function with more than expected no. of arguments --\n"; + +$option = 10; +$extra_arg = 10; +var_dump( xml_parser_get_option(null, $option, $extra_arg) ); + +// Testing xml_parser_get_option with one less than the expected number of arguments +echo "\n-- Testing xml_parser_get_option() function with less than expected no. of arguments --\n"; + +var_dump( xml_parser_get_option(null) ); +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_parser_get_option() : error conditions *** + +-- Testing xml_parser_get_option() function with more than expected no. of arguments -- + +Warning: xml_parser_get_option() expects exactly 2 parameters, 3 given in %s on line %d +NULL + +-- Testing xml_parser_get_option() function with less than expected no. of arguments -- + +Warning: xml_parser_get_option() expects exactly 2 parameters, 1 given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_parser_get_option_variation1.phpt b/ext/xml/tests/xml_parser_get_option_variation1.phpt new file mode 100644 index 0000000000..4edf1d6a0b --- /dev/null +++ b/ext/xml/tests/xml_parser_get_option_variation1.phpt @@ -0,0 +1,241 @@ +--TEST-- +Test xml_parser_get_option() function : usage variations +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_parser_get_option(resource parser, int option) + * Description: Get options from an XML parser + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_parser_get_option() : usage variations ***\n"; +error_reporting(E_ALL & ~E_NOTICE); + +class aClass { + function __toString() { + return "Some Ascii Data"; + } +} +// Initialise function arguments not being substituted (if any) +$option = 10; + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +$fp = fopen(__FILE__, "r"); + +//array of values to iterate over +$values = array( + + // int data + 0, + 1, + 12345, + -2345, + + // float data + 10.5, + -10.5, + 10.1234567e10, + 10.7654321E-10, + .5, + + // array data + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new aClass(), + + // resource data + $fp, + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for parser + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( xml_parser_get_option($value, $option) ); +}; + +fclose($fp); +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_parser_get_option() : usage variations *** + +Arg value 0 + +Warning: xml_parser_get_option() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_parser_get_option() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 12345 + +Warning: xml_parser_get_option() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value -2345 + +Warning: xml_parser_get_option() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 10.5 + +Warning: xml_parser_get_option() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value -10.5 + +Warning: xml_parser_get_option() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 101234567000 + +Warning: xml_parser_get_option() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 1.07654321E-9 + +Warning: xml_parser_get_option() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 0.5 + +Warning: xml_parser_get_option() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value Array + +Warning: xml_parser_get_option() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_parser_get_option() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_parser_get_option() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_parser_get_option() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_parser_get_option() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value + +Warning: xml_parser_get_option() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_parser_get_option() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_parser_get_option() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_parser_get_option() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_parser_get_option() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_parser_get_option() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_parser_get_option() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value + +Warning: xml_parser_get_option() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_parser_get_option() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_parser_get_option() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value Some Ascii Data + +Warning: xml_parser_get_option() expects parameter 1 to be resource, object given in %s on line %d +NULL + +Arg value Resource id %s + +Warning: xml_parser_get_option(): supplied resource is not a valid XML Parser resource in %s on line %d +bool(false) + +Arg value + +Warning: xml_parser_get_option() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_parser_get_option() expects parameter 1 to be resource, null given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_parser_get_option_variation2.phpt b/ext/xml/tests/xml_parser_get_option_variation2.phpt new file mode 100644 index 0000000000..de82111f83 --- /dev/null +++ b/ext/xml/tests/xml_parser_get_option_variation2.phpt @@ -0,0 +1,226 @@ +--TEST-- +Test xml_parser_get_option() function : usage variations +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_parser_get_option(resource parser, int option) + * Description: Get options from an XML parser + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_parser_get_option() : usage variations ***\n"; +error_reporting(E_ALL & ~E_NOTICE); + +class aClass { + function __toString() { + return "Some Ascii Data"; + } +} +// Initialise function arguments not being substituted (if any) +$parser = xml_parser_create(); + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +$fp = fopen(__FILE__, "r"); + +//array of values to iterate over +$values = array( + + // outside of range int data + 12345, + -2345, + + // float data + 10.5, + -10.5, + 10.1234567e10, + 10.7654321E-10, + .5, + + // array data + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new aClass(), + + // resource data + $fp, + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for option + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( xml_parser_get_option($parser, $value) ); +}; + +fclose($fp); +xml_parser_free($parser); +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_parser_get_option() : usage variations *** + +Arg value 12345 + +Warning: xml_parser_get_option(): Unknown option in %s on line %d +bool(false) + +Arg value -2345 + +Warning: xml_parser_get_option(): Unknown option in %s on line %d +bool(false) + +Arg value 10.5 + +Warning: xml_parser_get_option(): Unknown option in %s on line %d +bool(false) + +Arg value -10.5 + +Warning: xml_parser_get_option(): Unknown option in %s on line %d +bool(false) + +Arg value 101234567000 + +Warning: xml_parser_get_option(): Unknown option in %s on line %d +bool(false) + +Arg value 1.07654321E-9 + +Warning: xml_parser_get_option(): Unknown option in %s on line %d +bool(false) + +Arg value 0.5 + +Warning: xml_parser_get_option(): Unknown option in %s on line %d +bool(false) + +Arg value Array + +Warning: xml_parser_get_option() expects parameter 2 to be long, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_parser_get_option() expects parameter 2 to be long, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_parser_get_option() expects parameter 2 to be long, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_parser_get_option() expects parameter 2 to be long, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_parser_get_option() expects parameter 2 to be long, array given in %s on line %d +NULL + +Arg value + +Warning: xml_parser_get_option(): Unknown option in %s on line %d +bool(false) + +Arg value + +Warning: xml_parser_get_option(): Unknown option in %s on line %d +bool(false) + +Arg value 1 +int(1) + +Arg value + +Warning: xml_parser_get_option(): Unknown option in %s on line %d +bool(false) + +Arg value 1 +int(1) + +Arg value + +Warning: xml_parser_get_option(): Unknown option in %s on line %d +bool(false) + +Arg value + +Warning: xml_parser_get_option() expects parameter 2 to be long, string given in %s on line %d +NULL + +Arg value + +Warning: xml_parser_get_option() expects parameter 2 to be long, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_parser_get_option() expects parameter 2 to be long, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_parser_get_option() expects parameter 2 to be long, string given in %s on line %d +NULL + +Arg value Some Ascii Data + +Warning: xml_parser_get_option() expects parameter 2 to be long, object given in %s on line %d +NULL + +Arg value Resource id %s + +Warning: xml_parser_get_option() expects parameter 2 to be long, resource given in %s on line %d +NULL + +Arg value + +Warning: xml_parser_get_option(): Unknown option in %s on line %d +bool(false) + +Arg value + +Warning: xml_parser_get_option(): Unknown option in %s on line %d +bool(false) +Done + diff --git a/ext/xml/tests/xml_parser_set_option_basic.phpt b/ext/xml/tests/xml_parser_set_option_basic.phpt new file mode 100644 index 0000000000..61316a4b0f --- /dev/null +++ b/ext/xml/tests/xml_parser_set_option_basic.phpt @@ -0,0 +1,57 @@ +--TEST-- +Test xml_set_notation_decl_handler function : basic +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto bool xml_set_notation_decl_handler ( resource $parser , callback $handler ) + * Description: Sets the notation declaration handler function for the XML parser. + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "Simple testcase for xml_parser_get_option() function\n"; + +$parser = xml_parser_create_ns(); + +var_dump(xml_parser_get_option($parser, XML_OPTION_CASE_FOLDING)); +var_dump(xml_parser_get_option($parser, XML_OPTION_TARGET_ENCODING)); + +var_dump(xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 1)); +var_dump(xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, "ISO-8859-1")); + +var_dump(xml_parser_get_option($parser, XML_OPTION_CASE_FOLDING)); +var_dump(xml_parser_get_option($parser, XML_OPTION_TARGET_ENCODING)); + +var_dump(xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0)); +var_dump(xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, "UTF-8")); + +var_dump(xml_parser_get_option($parser, XML_OPTION_CASE_FOLDING)); +var_dump(xml_parser_get_option($parser, XML_OPTION_TARGET_ENCODING)); + +var_dump(xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, "US-ASCII")); +var_dump(xml_parser_get_option($parser, XML_OPTION_TARGET_ENCODING)); + +xml_parser_free( $parser ); + +echo "Done\n"; +?> +--EXPECT-- +Simple testcase for xml_parser_get_option() function +int(1) +string(5) "UTF-8" +bool(true) +bool(true) +int(1) +string(10) "ISO-8859-1" +bool(true) +bool(true) +int(0) +string(5) "UTF-8" +bool(true) +string(8) "US-ASCII" +Done diff --git a/ext/xml/tests/xml_parser_set_option_error.phpt b/ext/xml/tests/xml_parser_set_option_error.phpt new file mode 100644 index 0000000000..28829bcfa5 --- /dev/null +++ b/ext/xml/tests/xml_parser_set_option_error.phpt @@ -0,0 +1,49 @@ +--TEST-- +Test xml_parser_set_option() function : error conditions +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_parser_set_option(resource parser, int option, mixed value) + * Description: Set options in an XML parser + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_parser_set_option() : error conditions ***\n"; + + +//Test xml_parser_set_option with one more than the expected number of arguments +echo "\n-- Testing xml_parser_set_option() function with more than expected no. of arguments --\n"; + +$option = 10; +$value = 1; +$extra_arg = 10; +var_dump( xml_parser_set_option(null, $option, $value, $extra_arg) ); + +// Testing xml_parser_set_option with one less than the expected number of arguments +echo "\n-- Testing xml_parser_set_option() function with less than expected no. of arguments --\n"; + +$option = 10; +var_dump( xml_parser_set_option(null, $option) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_parser_set_option() : error conditions *** + +-- Testing xml_parser_set_option() function with more than expected no. of arguments -- + +Warning: xml_parser_set_option() expects exactly 3 parameters, 4 given in %s on line %d +NULL + +-- Testing xml_parser_set_option() function with less than expected no. of arguments -- + +Warning: xml_parser_set_option() expects exactly 3 parameters, 2 given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_parser_set_option_variation1.phpt b/ext/xml/tests/xml_parser_set_option_variation1.phpt new file mode 100644 index 0000000000..e3e3df8319 --- /dev/null +++ b/ext/xml/tests/xml_parser_set_option_variation1.phpt @@ -0,0 +1,241 @@ +--TEST-- +Test xml_parser_set_option() function : usage variations +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_parser_set_option(resource parser, int option, mixed value) + * Description: Set options in an XML parser + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_parser_set_option() : usage variations ***\n"; +error_reporting(E_ALL & ~E_NOTICE); + +class aClass { + function __toString() { + return "Some Ascii Data"; + } +} +// Initialise function arguments not being substituted (if any) +$option = 10; + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +$fp = fopen(__FILE__, "r"); + +//array of values to iterate over +$values = array( + + // int data + 0, + 1, + 12345, + -2345, + + // float data + 10.5, + -10.5, + 10.1234567e10, + 10.7654321E-10, + .5, + + // array data + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new aClass(), + + // resource data + $fp, + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for parser + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( xml_parser_set_option($value, $option, 1) ); +}; + +fclose($fp); +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_parser_set_option() : usage variations *** + +Arg value 0 + +Warning: xml_parser_set_option() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_parser_set_option() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 12345 + +Warning: xml_parser_set_option() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value -2345 + +Warning: xml_parser_set_option() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 10.5 + +Warning: xml_parser_set_option() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value -10.5 + +Warning: xml_parser_set_option() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 101234567000 + +Warning: xml_parser_set_option() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 1.07654321E-9 + +Warning: xml_parser_set_option() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 0.5 + +Warning: xml_parser_set_option() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value Array + +Warning: xml_parser_set_option() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_parser_set_option() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_parser_set_option() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_parser_set_option() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_parser_set_option() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value + +Warning: xml_parser_set_option() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_parser_set_option() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_parser_set_option() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_parser_set_option() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_parser_set_option() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_parser_set_option() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_parser_set_option() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value + +Warning: xml_parser_set_option() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_parser_set_option() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_parser_set_option() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value Some Ascii Data + +Warning: xml_parser_set_option() expects parameter 1 to be resource, object given in %s on line %d +NULL + +Arg value Resource id %s + +Warning: xml_parser_set_option(): supplied resource is not a valid XML Parser resource in %s on line %d +bool(false) + +Arg value + +Warning: xml_parser_set_option() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_parser_set_option() expects parameter 1 to be resource, null given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_parser_set_option_variation2.phpt b/ext/xml/tests/xml_parser_set_option_variation2.phpt new file mode 100644 index 0000000000..6f84ebb696 --- /dev/null +++ b/ext/xml/tests/xml_parser_set_option_variation2.phpt @@ -0,0 +1,215 @@ +--TEST-- +Test xml_parser_set_option() function : usage variations +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_parser_set_option(resource parser, int option, mixed value) + * Description: Set options in an XML parser + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_parser_set_option() : usage variations ***\n"; +error_reporting(E_ALL & ~E_NOTICE); + +class aClass { + function __toString() { + return "Some Ascii Data"; + } +} +// Initialise function arguments not being substituted (if any) +$parser = xml_parser_create(); + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +//array of values to iterate over +$values = array( + + // outside of range int data + 12345, + -2345, + + // float data + 10.5, + -10.5, + 10.1234567e10, + 10.7654321E-10, + .5, + + // array data + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new aClass(), + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for option + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( xml_parser_set_option($parser, $value, 1) ); +}; + +xml_parser_free($parser); +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_parser_set_option() : usage variations *** + +Arg value 12345 + +Warning: xml_parser_set_option(): Unknown option in %s on line %d +bool(false) + +Arg value -2345 + +Warning: xml_parser_set_option(): Unknown option in %s on line %d +bool(false) + +Arg value 10.5 + +Warning: xml_parser_set_option(): Unknown option in %s on line %d +bool(false) + +Arg value -10.5 + +Warning: xml_parser_set_option(): Unknown option in %s on line %d +bool(false) + +Arg value 101234567000 + +Warning: xml_parser_set_option(): Unknown option in %s on line %d +bool(false) + +Arg value 1.07654321E-9 + +Warning: xml_parser_set_option(): Unknown option in %s on line %d +bool(false) + +Arg value 0.5 + +Warning: xml_parser_set_option(): Unknown option in %s on line %d +bool(false) + +Arg value Array + +Warning: xml_parser_set_option() expects parameter 2 to be long, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_parser_set_option() expects parameter 2 to be long, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_parser_set_option() expects parameter 2 to be long, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_parser_set_option() expects parameter 2 to be long, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_parser_set_option() expects parameter 2 to be long, array given in %s on line %d +NULL + +Arg value + +Warning: xml_parser_set_option(): Unknown option in %s on line %d +bool(false) + +Arg value + +Warning: xml_parser_set_option(): Unknown option in %s on line %d +bool(false) + +Arg value 1 +bool(true) + +Arg value + +Warning: xml_parser_set_option(): Unknown option in %s on line %d +bool(false) + +Arg value 1 +bool(true) + +Arg value + +Warning: xml_parser_set_option(): Unknown option in %s on line %d +bool(false) + +Arg value + +Warning: xml_parser_set_option() expects parameter 2 to be long, string given in %s on line %d +NULL + +Arg value + +Warning: xml_parser_set_option() expects parameter 2 to be long, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_parser_set_option() expects parameter 2 to be long, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_parser_set_option() expects parameter 2 to be long, string given in %s on line %d +NULL + +Arg value Some Ascii Data + +Warning: xml_parser_set_option() expects parameter 2 to be long, object given in %s on line %d +NULL + +Arg value + +Warning: xml_parser_set_option(): Unknown option in %s on line %d +bool(false) + +Arg value + +Warning: xml_parser_set_option(): Unknown option in %s on line %d +bool(false) +Done + diff --git a/ext/xml/tests/xml_parser_set_option_variation3.phpt b/ext/xml/tests/xml_parser_set_option_variation3.phpt new file mode 100644 index 0000000000..5f98803905 --- /dev/null +++ b/ext/xml/tests/xml_parser_set_option_variation3.phpt @@ -0,0 +1,187 @@ +--TEST-- +Test xml_parser_set_option() function : usage variations +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_parser_set_option(resource parser, int option, mixed value) + * Description: Set options in an XML parser + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_parser_set_option() : usage variations ***\n"; +error_reporting(E_ALL & ~E_NOTICE); + +class aClass { + function __toString() { + return "Some Ascii Data"; + } +} +// Initialise function arguments not being substituted (if any) + +$parser = xml_parser_create(); +$option = 1; + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +$fp = fopen(__FILE__, "r"); + +//array of values to iterate over +$values = array( + + // int data + 0, + 1, + 12345, + -2345, + + // float data + 10.5, + -10.5, + 10.1234567e10, + 10.7654321E-10, + .5, + + // array data + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new aClass(), + + // resource data + $fp, + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for value + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( xml_parser_set_option($parser, $option, $value) ); +}; + +fclose($fp); +xml_parser_free($parser); +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_parser_set_option() : usage variations *** + +Arg value 0 +bool(true) + +Arg value 1 +bool(true) + +Arg value 12345 +bool(true) + +Arg value -2345 +bool(true) + +Arg value 10.5 +bool(true) + +Arg value -10.5 +bool(true) + +Arg value 101234567000 +bool(true) + +Arg value 1.07654321E-9 +bool(true) + +Arg value 0.5 +bool(true) + +Arg value Array +bool(true) + +Arg value Array +bool(true) + +Arg value Array +bool(true) + +Arg value Array +bool(true) + +Arg value Array +bool(true) + +Arg value +bool(true) + +Arg value +bool(true) + +Arg value 1 +bool(true) + +Arg value +bool(true) + +Arg value 1 +bool(true) + +Arg value +bool(true) + +Arg value +bool(true) + +Arg value +bool(true) + +Arg value string +bool(true) + +Arg value string +bool(true) + +Arg value Some Ascii Data +bool(true) + +Arg value Resource id %s +bool(true) + +Arg value +bool(true) + +Arg value +bool(true) +Done diff --git a/ext/xml/tests/xml_set_character_data_handler_error.phpt b/ext/xml/tests/xml_set_character_data_handler_error.phpt new file mode 100644 index 0000000000..16faaa4f67 --- /dev/null +++ b/ext/xml/tests/xml_set_character_data_handler_error.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test xml_set_character_data_handler() function : error conditions +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_set_character_data_handler(resource parser, string hdl) + * Description: Set up character data handler + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_set_character_data_handler() : error conditions ***\n"; + + +//Test xml_set_character_data_handler with one more than the expected number of arguments +echo "\n-- Testing xml_set_character_data_handler() function with more than expected no. of arguments --\n"; + +$hdl = 'string_val'; +$extra_arg = 10; +var_dump( xml_set_character_data_handler(null, $hdl, $extra_arg) ); + +// Testing xml_set_character_data_handler with one less than the expected number of arguments +echo "\n-- Testing xml_set_character_data_handler() function with less than expected no. of arguments --\n"; + +var_dump( xml_set_character_data_handler(null) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_set_character_data_handler() : error conditions *** + +-- Testing xml_set_character_data_handler() function with more than expected no. of arguments -- + +Warning: xml_set_character_data_handler() expects exactly 2 parameters, 3 given in %s on line %d +NULL + +-- Testing xml_set_character_data_handler() function with less than expected no. of arguments -- + +Warning: xml_set_character_data_handler() expects exactly 2 parameters, 1 given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_set_character_data_handler_variation1.phpt b/ext/xml/tests/xml_set_character_data_handler_variation1.phpt new file mode 100644 index 0000000000..bd384c9b62 --- /dev/null +++ b/ext/xml/tests/xml_set_character_data_handler_variation1.phpt @@ -0,0 +1,245 @@ +--TEST-- +Test xml_set_character_data_handler() function : usage variations +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_set_character_data_handler(resource parser, string hdl) + * Description: Set up character data handler + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_set_character_data_handler() : usage variations ***\n"; +error_reporting(E_ALL & ~E_NOTICE); + +class aClass { + function __toString() { + return "Some Ascii Data"; + } +} + +function validHandler(resource $parser ,string $data) { +} + +// Initialise function arguments not being substituted (if any) +$hdl = 'validHandler'; + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +$fp = fopen(__FILE__, "r"); + +//array of values to iterate over +$values = array( + + // int data + 0, + 1, + 12345, + -2345, + + // float data + 10.5, + -10.5, + 10.1234567e10, + 10.7654321E-10, + .5, + + // array data + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new aClass(), + + // resource data + $fp, + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for parser + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( xml_set_character_data_handler($value, $hdl) ); +}; + +fclose($fp); +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_set_character_data_handler() : usage variations *** + +Arg value 0 + +Warning: xml_set_character_data_handler() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_set_character_data_handler() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 12345 + +Warning: xml_set_character_data_handler() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value -2345 + +Warning: xml_set_character_data_handler() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 10.5 + +Warning: xml_set_character_data_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value -10.5 + +Warning: xml_set_character_data_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 101234567000 + +Warning: xml_set_character_data_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 1.07654321E-9 + +Warning: xml_set_character_data_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 0.5 + +Warning: xml_set_character_data_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_character_data_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_character_data_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_character_data_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_character_data_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_character_data_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value + +Warning: xml_set_character_data_handler() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_set_character_data_handler() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_set_character_data_handler() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_set_character_data_handler() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_set_character_data_handler() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_set_character_data_handler() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_set_character_data_handler() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value + +Warning: xml_set_character_data_handler() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_set_character_data_handler() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_set_character_data_handler() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value Some Ascii Data + +Warning: xml_set_character_data_handler() expects parameter 1 to be resource, object given in %s on line %d +NULL + +Arg value Resource id %s + +Warning: xml_set_character_data_handler(): supplied resource is not a valid XML Parser resource in %s on line %d +bool(false) + +Arg value + +Warning: xml_set_character_data_handler() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_set_character_data_handler() expects parameter 1 to be resource, null given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_set_default_handler_error.phpt b/ext/xml/tests/xml_set_default_handler_error.phpt new file mode 100644 index 0000000000..a4b1b7cbee --- /dev/null +++ b/ext/xml/tests/xml_set_default_handler_error.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test xml_set_default_handler() function : error conditions +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_set_default_handler(resource parser, string hdl) + * Description: Set up default handler + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_set_default_handler() : error conditions ***\n"; + + +//Test xml_set_default_handler with one more than the expected number of arguments +echo "\n-- Testing xml_set_default_handler() function with more than expected no. of arguments --\n"; + +$hdl = 'string_val'; +$extra_arg = 10; +var_dump( xml_set_default_handler(null, $hdl, $extra_arg) ); + +// Testing xml_set_default_handler with one less than the expected number of arguments +echo "\n-- Testing xml_set_default_handler() function with less than expected no. of arguments --\n"; + +var_dump( xml_set_default_handler(null) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_set_default_handler() : error conditions *** + +-- Testing xml_set_default_handler() function with more than expected no. of arguments -- + +Warning: xml_set_default_handler() expects exactly 2 parameters, 3 given in %s on line %d +NULL + +-- Testing xml_set_default_handler() function with less than expected no. of arguments -- + +Warning: xml_set_default_handler() expects exactly 2 parameters, 1 given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_set_default_handler_variation1.phpt b/ext/xml/tests/xml_set_default_handler_variation1.phpt new file mode 100644 index 0000000000..a887e01673 --- /dev/null +++ b/ext/xml/tests/xml_set_default_handler_variation1.phpt @@ -0,0 +1,245 @@ +--TEST-- +Test xml_set_default_handler() function : usage variations - test different types for parser +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_set_default_handler(resource parser, string hdl) + * Description: Set up default handler + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_set_default_handler() : usage variations ***\n"; +error_reporting(E_ALL & ~E_NOTICE); + +class aClass { + function __toString() { + return "Some Ascii Data"; + } +} + +function validHandler(resource $parser ,string $data) { +} + +// Initialise function arguments not being substituted (if any) +$hdl = 'validHandler'; + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +$fp = fopen(__FILE__, "r"); + +//array of values to iterate over +$values = array( + + // int data + 0, + 1, + 12345, + -2345, + + // float data + 10.5, + -10.5, + 10.1234567e10, + 10.7654321E-10, + .5, + + // array data + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new aClass(), + + // resource data + $fp, + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for parser + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( xml_set_default_handler($value, $hdl) ); +}; + +fclose($fp); +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_set_default_handler() : usage variations *** + +Arg value 0 + +Warning: xml_set_default_handler() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_set_default_handler() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 12345 + +Warning: xml_set_default_handler() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value -2345 + +Warning: xml_set_default_handler() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 10.5 + +Warning: xml_set_default_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value -10.5 + +Warning: xml_set_default_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 101234567000 + +Warning: xml_set_default_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 1.07654321E-9 + +Warning: xml_set_default_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 0.5 + +Warning: xml_set_default_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_default_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_default_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_default_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_default_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_default_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value + +Warning: xml_set_default_handler() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_set_default_handler() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_set_default_handler() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_set_default_handler() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_set_default_handler() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_set_default_handler() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_set_default_handler() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value + +Warning: xml_set_default_handler() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_set_default_handler() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_set_default_handler() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value Some Ascii Data + +Warning: xml_set_default_handler() expects parameter 1 to be resource, object given in %s on line %d +NULL + +Arg value Resource id %s + +Warning: xml_set_default_handler(): supplied resource is not a valid XML Parser resource in %s on line %d +bool(false) + +Arg value + +Warning: xml_set_default_handler() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_set_default_handler() expects parameter 1 to be resource, null given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_set_element_handler_error.phpt b/ext/xml/tests/xml_set_element_handler_error.phpt new file mode 100644 index 0000000000..6ccaea1552 --- /dev/null +++ b/ext/xml/tests/xml_set_element_handler_error.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test xml_set_element_handler() function : error conditions +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_set_element_handler(resource parser, string shdl, string ehdl) + * Description: Set up start and end element handlers + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_set_element_handler() : error conditions ***\n"; + + +//Test xml_set_element_handler with one more than the expected number of arguments +echo "\n-- Testing xml_set_element_handler() function with more than expected no. of arguments --\n"; + +$hdl = 'string_val'; +$extra_arg = 10; +var_dump( xml_set_element_handler(null, $hdl, $hdl, $extra_arg) ); + +// Testing xml_set_element_handler with one less than the expected number of arguments +echo "\n-- Testing xml_set_element_handler() function with less than expected no. of arguments --\n"; + +var_dump( xml_set_element_handler(null) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_set_element_handler() : error conditions *** + +-- Testing xml_set_element_handler() function with more than expected no. of arguments -- + +Warning: xml_set_element_handler() expects exactly 3 parameters, 4 given in %s on line %d +NULL + +-- Testing xml_set_element_handler() function with less than expected no. of arguments -- + +Warning: xml_set_element_handler() expects exactly 3 parameters, 1 given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_set_element_handler_variation1.phpt b/ext/xml/tests/xml_set_element_handler_variation1.phpt new file mode 100644 index 0000000000..83f370afea --- /dev/null +++ b/ext/xml/tests/xml_set_element_handler_variation1.phpt @@ -0,0 +1,245 @@ +--TEST-- +Test xml_set_element_handler() function : usage variations - test different types for parser +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_set_element_handler(resource parser, string shdl, string ehdl) + * Description: Set up start and end element handlers + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_set_element_handler() : usage variations ***\n"; +error_reporting(E_ALL & ~E_NOTICE); + +class aClass { + function __toString() { + return "Some Ascii Data"; + } +} + +function validHandler(resource $parser ,string $data) { +} + +// Initialise function arguments not being substituted (if any) +$hdl = 'validHandler'; + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +$fp = fopen(__FILE__, "r"); + +//array of values to iterate over +$values = array( + + // int data + 0, + 1, + 12345, + -2345, + + // float data + 10.5, + -10.5, + 10.1234567e10, + 10.7654321E-10, + .5, + + // array data + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new aClass(), + + // resource data + $fp, + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for parser + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( xml_set_element_handler($value, $hdl, $hdl) ); +}; + +fclose($fp); +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_set_element_handler() : usage variations *** + +Arg value 0 + +Warning: xml_set_element_handler() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_set_element_handler() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 12345 + +Warning: xml_set_element_handler() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value -2345 + +Warning: xml_set_element_handler() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 10.5 + +Warning: xml_set_element_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value -10.5 + +Warning: xml_set_element_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 101234567000 + +Warning: xml_set_element_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 1.07654321E-9 + +Warning: xml_set_element_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 0.5 + +Warning: xml_set_element_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_element_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_element_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_element_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_element_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_element_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value + +Warning: xml_set_element_handler() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_set_element_handler() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_set_element_handler() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_set_element_handler() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_set_element_handler() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_set_element_handler() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_set_element_handler() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value + +Warning: xml_set_element_handler() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_set_element_handler() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_set_element_handler() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value Some Ascii Data + +Warning: xml_set_element_handler() expects parameter 1 to be resource, object given in %s on line %d +NULL + +Arg value Resource id %s + +Warning: xml_set_element_handler(): supplied resource is not a valid XML Parser resource in %s on line %d +bool(false) + +Arg value + +Warning: xml_set_element_handler() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_set_element_handler() expects parameter 1 to be resource, null given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_set_end_namespace_decl_handler_error.phpt b/ext/xml/tests/xml_set_end_namespace_decl_handler_error.phpt new file mode 100644 index 0000000000..81bb3f6233 --- /dev/null +++ b/ext/xml/tests/xml_set_end_namespace_decl_handler_error.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test xml_set_end_namespace_decl_handler() function : error conditions +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_set_end_namespace_decl_handler(resource parser, string hdl) + * Description: Set up character data handler + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_set_end_namespace_decl_handler() : error conditions ***\n"; + + +//Test xml_set_end_namespace_decl_handler with one more than the expected number of arguments +echo "\n-- Testing xml_set_end_namespace_decl_handler() function with more than expected no. of arguments --\n"; + +$hdl = 'string_val'; +$extra_arg = 10; +var_dump( xml_set_end_namespace_decl_handler(null, $hdl, $extra_arg) ); + +// Testing xml_set_end_namespace_decl_handler with one less than the expected number of arguments +echo "\n-- Testing xml_set_end_namespace_decl_handler() function with less than expected no. of arguments --\n"; + +var_dump( xml_set_end_namespace_decl_handler(null) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_set_end_namespace_decl_handler() : error conditions *** + +-- Testing xml_set_end_namespace_decl_handler() function with more than expected no. of arguments -- + +Warning: xml_set_end_namespace_decl_handler() expects exactly 2 parameters, 3 given in %s on line %d +NULL + +-- Testing xml_set_end_namespace_decl_handler() function with less than expected no. of arguments -- + +Warning: xml_set_end_namespace_decl_handler() expects exactly 2 parameters, 1 given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_set_end_namespace_decl_handler_variation1.phpt b/ext/xml/tests/xml_set_end_namespace_decl_handler_variation1.phpt new file mode 100644 index 0000000000..c2fcacfe8b --- /dev/null +++ b/ext/xml/tests/xml_set_end_namespace_decl_handler_variation1.phpt @@ -0,0 +1,245 @@ +--TEST-- +Test xml_set_end_namespace_decl_handler() function : usage variations +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_set_end_namespace_decl_handler(resource parser, string hdl) + * Description: Set up character data handler + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_set_end_namespace_decl_handler() : usage variations ***\n"; +error_reporting(E_ALL & ~E_NOTICE); + +class aClass { + function __toString() { + return "Some Ascii Data"; + } +} + +function validHandler(resource $parser ,string $data) { +} + +// Initialise function arguments not being substituted (if any) +$hdl = 'validHandler'; + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +$fp = fopen(__FILE__, "r"); + +//array of values to iterate over +$values = array( + + // int data + 0, + 1, + 12345, + -2345, + + // float data + 10.5, + -10.5, + 10.1234567e10, + 10.7654321E-10, + .5, + + // array data + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new aClass(), + + // resource data + $fp, + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for parser + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( xml_set_end_namespace_decl_handler($value, $hdl) ); +}; + +fclose($fp); +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_set_end_namespace_decl_handler() : usage variations *** + +Arg value 0 + +Warning: xml_set_end_namespace_decl_handler() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_set_end_namespace_decl_handler() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 12345 + +Warning: xml_set_end_namespace_decl_handler() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value -2345 + +Warning: xml_set_end_namespace_decl_handler() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 10.5 + +Warning: xml_set_end_namespace_decl_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value -10.5 + +Warning: xml_set_end_namespace_decl_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 101234567000 + +Warning: xml_set_end_namespace_decl_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 1.07654321E-9 + +Warning: xml_set_end_namespace_decl_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 0.5 + +Warning: xml_set_end_namespace_decl_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_end_namespace_decl_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_end_namespace_decl_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_end_namespace_decl_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_end_namespace_decl_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_end_namespace_decl_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value + +Warning: xml_set_end_namespace_decl_handler() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_set_end_namespace_decl_handler() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_set_end_namespace_decl_handler() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_set_end_namespace_decl_handler() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_set_end_namespace_decl_handler() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_set_end_namespace_decl_handler() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_set_end_namespace_decl_handler() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value + +Warning: xml_set_end_namespace_decl_handler() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_set_end_namespace_decl_handler() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_set_end_namespace_decl_handler() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value Some Ascii Data + +Warning: xml_set_end_namespace_decl_handler() expects parameter 1 to be resource, object given in %s on line %d +NULL + +Arg value Resource id %s + +Warning: xml_set_end_namespace_decl_handler(): supplied resource is not a valid XML Parser resource in %s on line %d +bool(false) + +Arg value + +Warning: xml_set_end_namespace_decl_handler() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_set_end_namespace_decl_handler() expects parameter 1 to be resource, null given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_set_external_entity_ref_handler_error.phpt b/ext/xml/tests/xml_set_external_entity_ref_handler_error.phpt new file mode 100644 index 0000000000..6dd400ac84 --- /dev/null +++ b/ext/xml/tests/xml_set_external_entity_ref_handler_error.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test xml_set_external_entity_ref_handler() function : error conditions +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_set_external_entity_ref_handler(resource parser, string hdl) + * Description: Set up external entity reference handler + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_set_external_entity_ref_handler() : error conditions ***\n"; + + +//Test xml_set_external_entity_ref_handler with one more than the expected number of arguments +echo "\n-- Testing xml_set_external_entity_ref_handler() function with more than expected no. of arguments --\n"; + +$hdl = 'string_val'; +$extra_arg = 10; +var_dump( xml_set_external_entity_ref_handler(null, $hdl, $extra_arg) ); + +// Testing xml_set_external_entity_ref_handler with one less than the expected number of arguments +echo "\n-- Testing xml_set_external_entity_ref_handler() function with less than expected no. of arguments --\n"; + +var_dump( xml_set_external_entity_ref_handler(null) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_set_external_entity_ref_handler() : error conditions *** + +-- Testing xml_set_external_entity_ref_handler() function with more than expected no. of arguments -- + +Warning: xml_set_external_entity_ref_handler() expects exactly 2 parameters, 3 given in %s on line %d +NULL + +-- Testing xml_set_external_entity_ref_handler() function with less than expected no. of arguments -- + +Warning: xml_set_external_entity_ref_handler() expects exactly 2 parameters, 1 given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_set_external_entity_ref_handler_variation1.phpt b/ext/xml/tests/xml_set_external_entity_ref_handler_variation1.phpt new file mode 100644 index 0000000000..1ad6a11279 --- /dev/null +++ b/ext/xml/tests/xml_set_external_entity_ref_handler_variation1.phpt @@ -0,0 +1,245 @@ +--TEST-- +Test xml_set_external_entity_ref_handler() function : usage variations +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_set_external_entity_ref_handler(resource parser, string hdl) + * Description: Set up external entity reference handler + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_set_external_entity_ref_handler() : usage variations ***\n"; +error_reporting(E_ALL & ~E_NOTICE); + +class aClass { + function __toString() { + return "Some Ascii Data"; + } +} + +function validHandler(resource $parser ,string $data) { +} + +// Initialise function arguments not being substituted (if any) +$hdl = 'validHandler'; + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +$fp = fopen(__FILE__, "r"); + +//array of values to iterate over +$values = array( + + // int data + 0, + 1, + 12345, + -2345, + + // float data + 10.5, + -10.5, + 10.1234567e10, + 10.7654321E-10, + .5, + + // array data + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new aClass(), + + // resource data + $fp, + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for parser + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( xml_set_external_entity_ref_handler($value, $hdl) ); +}; + +fclose($fp); +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_set_external_entity_ref_handler() : usage variations *** + +Arg value 0 + +Warning: xml_set_external_entity_ref_handler() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_set_external_entity_ref_handler() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 12345 + +Warning: xml_set_external_entity_ref_handler() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value -2345 + +Warning: xml_set_external_entity_ref_handler() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 10.5 + +Warning: xml_set_external_entity_ref_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value -10.5 + +Warning: xml_set_external_entity_ref_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 101234567000 + +Warning: xml_set_external_entity_ref_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 1.07654321E-9 + +Warning: xml_set_external_entity_ref_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 0.5 + +Warning: xml_set_external_entity_ref_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_external_entity_ref_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_external_entity_ref_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_external_entity_ref_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_external_entity_ref_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_external_entity_ref_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value + +Warning: xml_set_external_entity_ref_handler() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_set_external_entity_ref_handler() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_set_external_entity_ref_handler() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_set_external_entity_ref_handler() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_set_external_entity_ref_handler() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_set_external_entity_ref_handler() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_set_external_entity_ref_handler() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value + +Warning: xml_set_external_entity_ref_handler() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_set_external_entity_ref_handler() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_set_external_entity_ref_handler() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value Some Ascii Data + +Warning: xml_set_external_entity_ref_handler() expects parameter 1 to be resource, object given in %s on line %d +NULL + +Arg value Resource id %s + +Warning: xml_set_external_entity_ref_handler(): supplied resource is not a valid XML Parser resource in %s on line %d +bool(false) + +Arg value + +Warning: xml_set_external_entity_ref_handler() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_set_external_entity_ref_handler() expects parameter 1 to be resource, null given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_set_notation_decl_handler_basic.phpt b/ext/xml/tests/xml_set_notation_decl_handler_basic.phpt new file mode 100644 index 0000000000..6616681ff8 --- /dev/null +++ b/ext/xml/tests/xml_set_notation_decl_handler_basic.phpt @@ -0,0 +1,102 @@ +--TEST-- +Test xml_set_notation_decl_handler function : basic +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto bool xml_set_notation_decl_handler ( resource $parser , callback $handler ) + * Description: Sets the notation declaration handler function for the XML parser. + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +class XML_Parser +{ + + function unparsed_entity_decl_handler($parser, $entity_name, $base, $system_ID, $public_ID, $notation_name) + { + echo "unparsed_entity_decl_handler called\n"; + echo "...Entity name=" . $entity_name . "\n"; + echo "...Base=" . $base . "\n"; + echo "...System ID=" . $system_ID . "\n"; + echo "...Public ID=" . $public_ID . "\n"; + echo "...Notation name=" . $notation_name . "\n"; + } + + function notation_decl_handler($parser, $name, $base, $system_ID,$public_ID) + { + echo "notation_decl_handler called\n"; + echo "...Name=" . $name . "\n"; + echo "...Base=" . $base . "\n"; + echo "...System ID=" . $system_ID . "\n"; + echo "...Public ID=" . $public_ID . "\n"; + } + + function parse($data) + { + $parser = xml_parser_create(); + xml_set_object($parser, $this); + xml_set_notation_decl_handler($parser, "notation_decl_handler"); + xml_set_unparsed_entity_decl_handler($parser, "unparsed_entity_decl_handler"); + xml_parse($parser, $data, true); + xml_parser_free($parser); + } +} + +$xml = <<<HERE +<?xml version="1.0"?> +<!DOCTYPE dates [ + <!NOTATION USDATE SYSTEM "http://www.schema.net/usdate.not"> + <!NOTATION AUSDATE SYSTEM "http://www.schema.net/ausdate.not"> + <!NOTATION ISODATE SYSTEM "http://www.schema.net/isodate.not"> + <!ENTITY testUS SYSTEM "test_usdate.xml" NDATA USDATE> + <!ENTITY testAUS SYSTEM "test_ausdate.xml" NDATA AUSDATE> + <!ENTITY testISO SYSTEM "test_isodate_xml" NDATA ISODATE>]> +]> +HERE; + +echo "Simple test of xml_set_notation_decl_handler(() function\n"; +$p1 = new Xml_Parser(); +$p1->parse($xml); +echo "Done\n"; +?> +--EXPECT-- +Simple test of xml_set_notation_decl_handler(() function +notation_decl_handler called +...Name=USDATE +...Base= +...System ID=http://www.schema.net/usdate.not +...Public ID= +notation_decl_handler called +...Name=AUSDATE +...Base= +...System ID=http://www.schema.net/ausdate.not +...Public ID= +notation_decl_handler called +...Name=ISODATE +...Base= +...System ID=http://www.schema.net/isodate.not +...Public ID= +unparsed_entity_decl_handler called +...Entity name=testUS +...Base= +...System ID=test_usdate.xml +...Public ID= +...Notation name=USDATE +unparsed_entity_decl_handler called +...Entity name=testAUS +...Base= +...System ID=test_ausdate.xml +...Public ID= +...Notation name=AUSDATE +unparsed_entity_decl_handler called +...Entity name=testISO +...Base= +...System ID=test_isodate_xml +...Public ID= +...Notation name=ISODATE +Done diff --git a/ext/xml/tests/xml_set_notation_decl_handler_error.phpt b/ext/xml/tests/xml_set_notation_decl_handler_error.phpt new file mode 100644 index 0000000000..fccc135f76 --- /dev/null +++ b/ext/xml/tests/xml_set_notation_decl_handler_error.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test xml_set_notation_decl_handler() function : error conditions +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_set_notation_decl_handler(resource parser, string hdl) + * Description: Set up notation declaration handler + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_set_notation_decl_handler() : error conditions ***\n"; + + +//Test xml_set_notation_decl_handler with one more than the expected number of arguments +echo "\n-- Testing xml_set_notation_decl_handler() function with more than expected no. of arguments --\n"; + +$hdl = 'string_val'; +$extra_arg = 10; +var_dump( xml_set_notation_decl_handler(null, $hdl, $extra_arg) ); + +// Testing xml_set_notation_decl_handler with one less than the expected number of arguments +echo "\n-- Testing xml_set_notation_decl_handler() function with less than expected no. of arguments --\n"; + +var_dump( xml_set_notation_decl_handler(null) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_set_notation_decl_handler() : error conditions *** + +-- Testing xml_set_notation_decl_handler() function with more than expected no. of arguments -- + +Warning: xml_set_notation_decl_handler() expects exactly 2 parameters, 3 given in %s on line %d +NULL + +-- Testing xml_set_notation_decl_handler() function with less than expected no. of arguments -- + +Warning: xml_set_notation_decl_handler() expects exactly 2 parameters, 1 given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_set_notation_decl_handler_variation1.phpt b/ext/xml/tests/xml_set_notation_decl_handler_variation1.phpt new file mode 100644 index 0000000000..d89b04d2a5 --- /dev/null +++ b/ext/xml/tests/xml_set_notation_decl_handler_variation1.phpt @@ -0,0 +1,245 @@ +--TEST-- +Test xml_set_notation_decl_handler() function : usage variations +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_set_notation_decl_handler(resource parser, string hdl) + * Description: Set up notation declaration handler + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_set_notation_decl_handler() : usage variations ***\n"; +error_reporting(E_ALL & ~E_NOTICE); + +class aClass { + function __toString() { + return "Some Ascii Data"; + } +} + +function validHandler(resource $parser ,string $data) { +} + +// Initialise function arguments not being substituted (if any) +$hdl = 'validHandler'; + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +$fp = fopen(__FILE__, "r"); + +//array of values to iterate over +$values = array( + + // int data + 0, + 1, + 12345, + -2345, + + // float data + 10.5, + -10.5, + 10.1234567e10, + 10.7654321E-10, + .5, + + // array data + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new aClass(), + + // resource data + $fp, + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for parser + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( xml_set_notation_decl_handler($value, $hdl) ); +}; + +fclose($fp); +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_set_notation_decl_handler() : usage variations *** + +Arg value 0 + +Warning: xml_set_notation_decl_handler() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_set_notation_decl_handler() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 12345 + +Warning: xml_set_notation_decl_handler() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value -2345 + +Warning: xml_set_notation_decl_handler() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 10.5 + +Warning: xml_set_notation_decl_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value -10.5 + +Warning: xml_set_notation_decl_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 101234567000 + +Warning: xml_set_notation_decl_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 1.07654321E-9 + +Warning: xml_set_notation_decl_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 0.5 + +Warning: xml_set_notation_decl_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_notation_decl_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_notation_decl_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_notation_decl_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_notation_decl_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_notation_decl_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value + +Warning: xml_set_notation_decl_handler() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_set_notation_decl_handler() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_set_notation_decl_handler() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_set_notation_decl_handler() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_set_notation_decl_handler() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_set_notation_decl_handler() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_set_notation_decl_handler() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value + +Warning: xml_set_notation_decl_handler() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_set_notation_decl_handler() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_set_notation_decl_handler() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value Some Ascii Data + +Warning: xml_set_notation_decl_handler() expects parameter 1 to be resource, object given in %s on line %d +NULL + +Arg value Resource id %s + +Warning: xml_set_notation_decl_handler(): supplied resource is not a valid XML Parser resource in %s on line %d +bool(false) + +Arg value + +Warning: xml_set_notation_decl_handler() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_set_notation_decl_handler() expects parameter 1 to be resource, null given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_set_object_error.phpt b/ext/xml/tests/xml_set_object_error.phpt new file mode 100644 index 0000000000..db3266ea13 --- /dev/null +++ b/ext/xml/tests/xml_set_object_error.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test xml_set_object() function : error conditions +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_set_object(resource parser, object &obj) + * Description: Set up object which should be used for callbacks + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_set_object() : error conditions ***\n"; + + +//Test xml_set_object with one more than the expected number of arguments +echo "\n-- Testing xml_set_object() function with more than expected no. of arguments --\n"; + +//WARNING: Unable to initialise parser of type resource + +$obj = new stdclass(); +$extra_arg = 10; +var_dump( xml_set_object(null, $obj, $extra_arg) ); + +// Testing xml_set_object with one less than the expected number of arguments +echo "\n-- Testing xml_set_object() function with less than expected no. of arguments --\n"; + +//WARNING: Unable to initialise parser of type resource + +var_dump( xml_set_object(null) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_set_object() : error conditions *** + +-- Testing xml_set_object() function with more than expected no. of arguments -- + +Warning: xml_set_object() expects exactly 2 parameters, 3 given in %s on line %d +NULL + +-- Testing xml_set_object() function with less than expected no. of arguments -- + +Warning: xml_set_object() expects exactly 2 parameters, 1 given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_set_object_variation1.phpt b/ext/xml/tests/xml_set_object_variation1.phpt new file mode 100644 index 0000000000..cc40445725 --- /dev/null +++ b/ext/xml/tests/xml_set_object_variation1.phpt @@ -0,0 +1,241 @@ +--TEST-- +Test xml_set_object() function : usage variations +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_set_object(resource parser, object &obj) + * Description: Set up object which should be used for callbacks + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_set_object() : usage variations ***\n"; +error_reporting(E_ALL & ~E_NOTICE); + +class aClass { + function __toString() { + return "Some Ascii Data"; + } +} +// Initialise function arguments not being substituted (if any) +$obj = new aClass(); + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +$fp = fopen(__FILE__, "r"); + +//array of values to iterate over +$values = array( + + // int data + 0, + 1, + 12345, + -2345, + + // float data + 10.5, + -10.5, + 10.1234567e10, + 10.7654321E-10, + .5, + + // array data + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new aClass(), + + // resource data + $fp, + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for parser + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( xml_set_object($value, $obj) ); +}; + +fclose($fp); +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_set_object() : usage variations *** + +Arg value 0 + +Warning: xml_set_object() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_set_object() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 12345 + +Warning: xml_set_object() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value -2345 + +Warning: xml_set_object() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 10.5 + +Warning: xml_set_object() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value -10.5 + +Warning: xml_set_object() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 101234567000 + +Warning: xml_set_object() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 1.07654321E-9 + +Warning: xml_set_object() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 0.5 + +Warning: xml_set_object() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_object() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_object() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_object() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_object() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_object() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value + +Warning: xml_set_object() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_set_object() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_set_object() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_set_object() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_set_object() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_set_object() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_set_object() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value + +Warning: xml_set_object() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_set_object() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_set_object() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value Some Ascii Data + +Warning: xml_set_object() expects parameter 1 to be resource, object given in %s on line %d +NULL + +Arg value Resource id %s + +Warning: xml_set_object(): supplied resource is not a valid XML Parser resource in %s on line %d +bool(false) + +Arg value + +Warning: xml_set_object() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_set_object() expects parameter 1 to be resource, null given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_set_object_variation2.phpt b/ext/xml/tests/xml_set_object_variation2.phpt new file mode 100644 index 0000000000..210544c45d --- /dev/null +++ b/ext/xml/tests/xml_set_object_variation2.phpt @@ -0,0 +1,230 @@ +--TEST-- +Test xml_set_object() function : usage variations +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_set_object(resource parser, object &obj) + * Description: Set up object which should be used for callbacks + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_set_object() : usage variations ***\n"; +error_reporting(E_ALL & ~E_NOTICE); +// Initialise function arguments not being substituted (if any) + +$parser = xml_parser_create(); +$fp = fopen(__FILE__, "r"); + + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +//array of values to iterate over +$values = array( + + // int data + 0, + 1, + 12345, + -2345, + + // float data + 10.5, + -10.5, + 10.1234567e10, + 10.7654321E-10, + .5, + + // array data + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // resource data + $fp, + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for obj + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( xml_set_object($parser, $value) ); +}; + +xml_parser_free($parser); +fclose($fp); + +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_set_object() : usage variations *** + +Arg value 0 + +Warning: xml_set_object() expects parameter 2 to be object, integer given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_set_object() expects parameter 2 to be object, integer given in %s on line %d +NULL + +Arg value 12345 + +Warning: xml_set_object() expects parameter 2 to be object, integer given in %s on line %d +NULL + +Arg value -2345 + +Warning: xml_set_object() expects parameter 2 to be object, integer given in %s on line %d +NULL + +Arg value 10.5 + +Warning: xml_set_object() expects parameter 2 to be object, double given in %s on line %d +NULL + +Arg value -10.5 + +Warning: xml_set_object() expects parameter 2 to be object, double given in %s on line %d +NULL + +Arg value 101234567000 + +Warning: xml_set_object() expects parameter 2 to be object, double given in %s on line %d +NULL + +Arg value 1.07654321E-9 + +Warning: xml_set_object() expects parameter 2 to be object, double given in %s on line %d +NULL + +Arg value 0.5 + +Warning: xml_set_object() expects parameter 2 to be object, double given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_object() expects parameter 2 to be object, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_object() expects parameter 2 to be object, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_object() expects parameter 2 to be object, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_object() expects parameter 2 to be object, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_object() expects parameter 2 to be object, array given in %s on line %d +NULL + +Arg value + +Warning: xml_set_object() expects parameter 2 to be object, null given in %s on line %d +NULL + +Arg value + +Warning: xml_set_object() expects parameter 2 to be object, null given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_set_object() expects parameter 2 to be object, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_set_object() expects parameter 2 to be object, boolean given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_set_object() expects parameter 2 to be object, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_set_object() expects parameter 2 to be object, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_set_object() expects parameter 2 to be object, string given in %s on line %d +NULL + +Arg value + +Warning: xml_set_object() expects parameter 2 to be object, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_set_object() expects parameter 2 to be object, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_set_object() expects parameter 2 to be object, string given in %s on line %d +NULL + +Arg value Resource id %s + +Warning: xml_set_object() expects parameter 2 to be object, resource given in %s on line %d +NULL + +Arg value + +Warning: xml_set_object() expects parameter 2 to be object, null given in %s on line %d +NULL + +Arg value + +Warning: xml_set_object() expects parameter 2 to be object, null given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_set_processing_instruction_handler_basic.phpt b/ext/xml/tests/xml_set_processing_instruction_handler_basic.phpt new file mode 100644 index 0000000000..e5589cee29 --- /dev/null +++ b/ext/xml/tests/xml_set_processing_instruction_handler_basic.phpt @@ -0,0 +1,52 @@ +--TEST-- +Test xml_set_processing_instruction_handler function : basic +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto bool xml_set_processing_instruction_handler ( resource $parser , callback $handler ) + * Description: Sets the processing instruction (PI) handler function for the XML parser. + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +class XML_Parser +{ + + function PIHandler($parser, $target, $data) + { + echo "Target: " . $target. "\n"; + echo "Data: " . $data . "\n"; + } + + function parse($data) + { + $parser = xml_parser_create(); + xml_set_object($parser, $this); + xml_set_processing_instruction_handler($parser, "PIHandler"); + xml_parse($parser, $data, true); + xml_parser_free($parser); + } + + +} + +$xml = <<<HERE +<?xml version="1.0" encoding="ISO-8859-1"?> +<?xml-stylesheet href="default.xsl" type="text/xml"?> +HERE; + +echo "Simple test of xml_set_processing_instruction_handler() function\n"; +$p1 = new Xml_Parser(); +$p1->parse($xml); +echo "Done\n"; +?> +--EXPECT-- +Simple test of xml_set_processing_instruction_handler() function +Target: xml-stylesheet +Data: href="default.xsl" type="text/xml" +Done
\ No newline at end of file diff --git a/ext/xml/tests/xml_set_processing_instruction_handler_error.phpt b/ext/xml/tests/xml_set_processing_instruction_handler_error.phpt new file mode 100644 index 0000000000..f2a8494d54 --- /dev/null +++ b/ext/xml/tests/xml_set_processing_instruction_handler_error.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test xml_set_processing_instruction_handler() function : error conditions +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_set_processing_instruction_handler(resource parser, string hdl) + * Description: Set up processing instruction (PI) handler + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_set_processing_instruction_handler() : error conditions ***\n"; + + +//Test xml_set_processing_instruction_handler with one more than the expected number of arguments +echo "\n-- Testing xml_set_processing_instruction_handler() function with more than expected no. of arguments --\n"; + +$hdl = 'string_val'; +$extra_arg = 10; +var_dump( xml_set_processing_instruction_handler(null, $hdl, $extra_arg) ); + +// Testing xml_set_processing_instruction_handler with one less than the expected number of arguments +echo "\n-- Testing xml_set_processing_instruction_handler() function with less than expected no. of arguments --\n"; + +var_dump( xml_set_processing_instruction_handler(null) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_set_processing_instruction_handler() : error conditions *** + +-- Testing xml_set_processing_instruction_handler() function with more than expected no. of arguments -- + +Warning: xml_set_processing_instruction_handler() expects exactly 2 parameters, 3 given in %s on line %d +NULL + +-- Testing xml_set_processing_instruction_handler() function with less than expected no. of arguments -- + +Warning: xml_set_processing_instruction_handler() expects exactly 2 parameters, 1 given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_set_processing_instruction_handler_variation1.phpt b/ext/xml/tests/xml_set_processing_instruction_handler_variation1.phpt new file mode 100644 index 0000000000..74cc1e5580 --- /dev/null +++ b/ext/xml/tests/xml_set_processing_instruction_handler_variation1.phpt @@ -0,0 +1,245 @@ +--TEST-- +Test xml_set_processing_instruction_handler() function : usage variations +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_set_processing_instruction_handler(resource parser, string hdl) + * Description: Set up processing instruction (PI) handler + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_set_processing_instruction_handler() : usage variations ***\n"; +error_reporting(E_ALL & ~E_NOTICE); + +class aClass { + function __toString() { + return "Some Ascii Data"; + } +} + +function validHandler(resource $parser ,string $data) { +} + +// Initialise function arguments not being substituted (if any) +$hdl = 'validHandler'; + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +$fp = fopen(__FILE__, "r"); + +//array of values to iterate over +$values = array( + + // int data + 0, + 1, + 12345, + -2345, + + // float data + 10.5, + -10.5, + 10.1234567e10, + 10.7654321E-10, + .5, + + // array data + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new aClass(), + + // resource data + $fp, + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for parser + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( xml_set_processing_instruction_handler($value, $hdl) ); +}; + +fclose($fp); +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_set_processing_instruction_handler() : usage variations *** + +Arg value 0 + +Warning: xml_set_processing_instruction_handler() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_set_processing_instruction_handler() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 12345 + +Warning: xml_set_processing_instruction_handler() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value -2345 + +Warning: xml_set_processing_instruction_handler() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 10.5 + +Warning: xml_set_processing_instruction_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value -10.5 + +Warning: xml_set_processing_instruction_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 101234567000 + +Warning: xml_set_processing_instruction_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 1.07654321E-9 + +Warning: xml_set_processing_instruction_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 0.5 + +Warning: xml_set_processing_instruction_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_processing_instruction_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_processing_instruction_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_processing_instruction_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_processing_instruction_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_processing_instruction_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value + +Warning: xml_set_processing_instruction_handler() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_set_processing_instruction_handler() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_set_processing_instruction_handler() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_set_processing_instruction_handler() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_set_processing_instruction_handler() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_set_processing_instruction_handler() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_set_processing_instruction_handler() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value + +Warning: xml_set_processing_instruction_handler() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_set_processing_instruction_handler() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_set_processing_instruction_handler() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value Some Ascii Data + +Warning: xml_set_processing_instruction_handler() expects parameter 1 to be resource, object given in %s on line %d +NULL + +Arg value Resource id %s + +Warning: xml_set_processing_instruction_handler(): supplied resource is not a valid XML Parser resource in %s on line %d +bool(false) + +Arg value + +Warning: xml_set_processing_instruction_handler() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_set_processing_instruction_handler() expects parameter 1 to be resource, null given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_set_start_namespace_decl_handler_basic.phpt b/ext/xml/tests/xml_set_start_namespace_decl_handler_basic.phpt new file mode 100644 index 0000000000..79b8cb88fc --- /dev/null +++ b/ext/xml/tests/xml_set_start_namespace_decl_handler_basic.phpt @@ -0,0 +1,61 @@ +--TEST-- +Test xml_set_start_namespace_decl_handler function: basic +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : bool xml_set_start_namespace_decl_handler ( resource $parser , callback $handler ) + * Description: Set up start namespace declaration handler. + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +$xml = <<<HERE +<aw1:book xmlns:aw1="http://www.somewhere.com/namespace1" + xmlns:aw2="file:/DTD/somewhere.dtd"> +<aw1:para>Any old text.</aw1:para> +<aw2:td>An HTML table cell.</aw2:td> +</aw1:book> +HERE; + +$parser = xml_parser_create_ns(); +xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); + +var_dump(xml_set_start_namespace_decl_handler( $parser, "Namespace_Start_Handler" )); +var_dump(xml_set_end_namespace_decl_handler( $parser, "Namespace_End_Handler" )); + +xml_parse( $parser, $xml, true); +xml_parser_free( $parser ); + +echo "Done\n"; + +function Namespace_Start_Handler( $parser, $prefix, $uri ) { + echo "Namespace_Start_Handler called\n"; + echo "...Prefix: ". $prefix . "\n"; + echo "...Uri: ". $uri . "\n"; +} + +function Namespace_End_Handler($parser, $prefix) { + echo "Namespace_End_Handler called\n"; + echo "...Prefix: ". $prefix . "\n\n"; +} + +function DefaultHandler( $parser, $data ) { + print( 'DefaultHandler Called<br/>' ); +} +?> +--EXPECT-- +bool(true) +bool(true) +Namespace_Start_Handler called +...Prefix: aw1 +...Uri: http://www.somewhere.com/namespace1 +Namespace_Start_Handler called +...Prefix: aw2 +...Uri: file:/DTD/somewhere.dtd +Done + diff --git a/ext/xml/tests/xml_set_start_namespace_decl_handler_error.phpt b/ext/xml/tests/xml_set_start_namespace_decl_handler_error.phpt new file mode 100644 index 0000000000..221b005dfd --- /dev/null +++ b/ext/xml/tests/xml_set_start_namespace_decl_handler_error.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test xml_set_start_namespace_decl_handler() function : error conditions +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_set_start_namespace_decl_handler(resource parser, string hdl) + * Description: Set up character data handler + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_set_start_namespace_decl_handler() : error conditions ***\n"; + + +//Test xml_set_start_namespace_decl_handler with one more than the expected number of arguments +echo "\n-- Testing xml_set_start_namespace_decl_handler() function with more than expected no. of arguments --\n"; + +$hdl = 'string_val'; +$extra_arg = 10; +var_dump( xml_set_start_namespace_decl_handler(null, $hdl, $extra_arg) ); + +// Testing xml_set_start_namespace_decl_handler with one less than the expected number of arguments +echo "\n-- Testing xml_set_start_namespace_decl_handler() function with less than expected no. of arguments --\n"; + +var_dump( xml_set_start_namespace_decl_handler(null) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_set_start_namespace_decl_handler() : error conditions *** + +-- Testing xml_set_start_namespace_decl_handler() function with more than expected no. of arguments -- + +Warning: xml_set_start_namespace_decl_handler() expects exactly 2 parameters, 3 given in %s on line %d +NULL + +-- Testing xml_set_start_namespace_decl_handler() function with less than expected no. of arguments -- + +Warning: xml_set_start_namespace_decl_handler() expects exactly 2 parameters, 1 given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_set_start_namespace_decl_handler_variation1.phpt b/ext/xml/tests/xml_set_start_namespace_decl_handler_variation1.phpt new file mode 100644 index 0000000000..c0323b36ae --- /dev/null +++ b/ext/xml/tests/xml_set_start_namespace_decl_handler_variation1.phpt @@ -0,0 +1,245 @@ +--TEST-- +Test xml_set_start_namespace_decl_handler() function : usage variations +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_set_start_namespace_decl_handler(resource parser, string hdl) + * Description: Set up character data handler + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_set_start_namespace_decl_handler() : usage variations ***\n"; +error_reporting(E_ALL & ~E_NOTICE); + +class aClass { + function __toString() { + return "Some Ascii Data"; + } +} + +function validHandler(resource $parser ,string $data) { +} + +// Initialise function arguments not being substituted (if any) +$hdl = 'validHandler'; + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +$fp = fopen(__FILE__, "r"); + +//array of values to iterate over +$values = array( + + // int data + 0, + 1, + 12345, + -2345, + + // float data + 10.5, + -10.5, + 10.1234567e10, + 10.7654321E-10, + .5, + + // array data + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new aClass(), + + // resource data + $fp, + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for parser + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( xml_set_start_namespace_decl_handler($value, $hdl) ); +}; + +fclose($fp); +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_set_start_namespace_decl_handler() : usage variations *** + +Arg value 0 + +Warning: xml_set_start_namespace_decl_handler() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_set_start_namespace_decl_handler() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 12345 + +Warning: xml_set_start_namespace_decl_handler() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value -2345 + +Warning: xml_set_start_namespace_decl_handler() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 10.5 + +Warning: xml_set_start_namespace_decl_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value -10.5 + +Warning: xml_set_start_namespace_decl_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 101234567000 + +Warning: xml_set_start_namespace_decl_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 1.07654321E-9 + +Warning: xml_set_start_namespace_decl_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 0.5 + +Warning: xml_set_start_namespace_decl_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_start_namespace_decl_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_start_namespace_decl_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_start_namespace_decl_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_start_namespace_decl_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_start_namespace_decl_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value + +Warning: xml_set_start_namespace_decl_handler() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_set_start_namespace_decl_handler() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_set_start_namespace_decl_handler() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_set_start_namespace_decl_handler() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_set_start_namespace_decl_handler() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_set_start_namespace_decl_handler() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_set_start_namespace_decl_handler() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value + +Warning: xml_set_start_namespace_decl_handler() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_set_start_namespace_decl_handler() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_set_start_namespace_decl_handler() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value Some Ascii Data + +Warning: xml_set_start_namespace_decl_handler() expects parameter 1 to be resource, object given in %s on line %d +NULL + +Arg value Resource id %s + +Warning: xml_set_start_namespace_decl_handler(): supplied resource is not a valid XML Parser resource in %s on line %d +bool(false) + +Arg value + +Warning: xml_set_start_namespace_decl_handler() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_set_start_namespace_decl_handler() expects parameter 1 to be resource, null given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_set_unparsed_entity_decl_handler_error.phpt b/ext/xml/tests/xml_set_unparsed_entity_decl_handler_error.phpt new file mode 100644 index 0000000000..952a6984b4 --- /dev/null +++ b/ext/xml/tests/xml_set_unparsed_entity_decl_handler_error.phpt @@ -0,0 +1,47 @@ +--TEST-- +Test xml_set_unparsed_entity_decl_handler() function : error conditions +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_set_unparsed_entity_decl_handler(resource parser, string hdl) + * Description: Set up unparsed entity declaration handler + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_set_unparsed_entity_decl_handler() : error conditions ***\n"; + + +//Test xml_set_unparsed_entity_decl_handler with one more than the expected number of arguments +echo "\n-- Testing xml_set_unparsed_entity_decl_handler() function with more than expected no. of arguments --\n"; + +$hdl = 'string_val'; +$extra_arg = 10; +var_dump( xml_set_unparsed_entity_decl_handler(null, $hdl, $extra_arg) ); + +// Testing xml_set_unparsed_entity_decl_handler with one less than the expected number of arguments +echo "\n-- Testing xml_set_unparsed_entity_decl_handler() function with less than expected no. of arguments --\n"; + +var_dump( xml_set_unparsed_entity_decl_handler(null) ); + +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_set_unparsed_entity_decl_handler() : error conditions *** + +-- Testing xml_set_unparsed_entity_decl_handler() function with more than expected no. of arguments -- + +Warning: xml_set_unparsed_entity_decl_handler() expects exactly 2 parameters, 3 given in %s on line %d +NULL + +-- Testing xml_set_unparsed_entity_decl_handler() function with less than expected no. of arguments -- + +Warning: xml_set_unparsed_entity_decl_handler() expects exactly 2 parameters, 1 given in %s on line %d +NULL +Done + diff --git a/ext/xml/tests/xml_set_unparsed_entity_decl_handler_variation1.phpt b/ext/xml/tests/xml_set_unparsed_entity_decl_handler_variation1.phpt new file mode 100644 index 0000000000..04290fa4e1 --- /dev/null +++ b/ext/xml/tests/xml_set_unparsed_entity_decl_handler_variation1.phpt @@ -0,0 +1,245 @@ +--TEST-- +Test xml_set_unparsed_entity_decl_handler() function : usage variations +--SKIPIF-- +<?php +if (!extension_loaded("xml")) { + print "skip - XML extension not loaded"; +} +?> +--FILE-- +<?php +/* Prototype : proto int xml_set_unparsed_entity_decl_handler(resource parser, string hdl) + * Description: Set up unparsed entity declaration handler + * Source code: ext/xml/xml.c + * Alias to functions: + */ + +echo "*** Testing xml_set_unparsed_entity_decl_handler() : usage variations ***\n"; +error_reporting(E_ALL & ~E_NOTICE); + +class aClass { + function __toString() { + return "Some Ascii Data"; + } +} + +function validHandler(resource $parser ,string $data) { +} + +// Initialise function arguments not being substituted (if any) +$hdl = 'validHandler'; + +//get an unset variable +$unset_var = 10; +unset ($unset_var); + +$fp = fopen(__FILE__, "r"); + +//array of values to iterate over +$values = array( + + // int data + 0, + 1, + 12345, + -2345, + + // float data + 10.5, + -10.5, + 10.1234567e10, + 10.7654321E-10, + .5, + + // array data + array(), + array(0), + array(1), + array(1, 2), + array('color' => 'red', 'item' => 'pen'), + + // null data + NULL, + null, + + // boolean data + true, + false, + TRUE, + FALSE, + + // empty data + "", + '', + + // string data + "string", + 'string', + + // object data + new aClass(), + + // resource data + $fp, + + // undefined data + $undefined_var, + + // unset data + $unset_var, +); + +// loop through each element of the array for parser + +foreach($values as $value) { + echo "\nArg value $value \n"; + var_dump( xml_set_unparsed_entity_decl_handler($value, $hdl) ); +}; + +fclose($fp); +echo "Done"; +?> +--EXPECTF-- +*** Testing xml_set_unparsed_entity_decl_handler() : usage variations *** + +Arg value 0 + +Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 12345 + +Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value -2345 + +Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, integer given in %s on line %d +NULL + +Arg value 10.5 + +Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value -10.5 + +Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 101234567000 + +Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 1.07654321E-9 + +Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value 0.5 + +Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, double given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value Array + +Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, array given in %s on line %d +NULL + +Arg value + +Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value 1 + +Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, boolean given in %s on line %d +NULL + +Arg value + +Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value + +Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value string + +Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, string given in %s on line %d +NULL + +Arg value Some Ascii Data + +Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, object given in %s on line %d +NULL + +Arg value Resource id %s + +Warning: xml_set_unparsed_entity_decl_handler(): supplied resource is not a valid XML Parser resource in %s on line %d +bool(false) + +Arg value + +Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, null given in %s on line %d +NULL + +Arg value + +Warning: xml_set_unparsed_entity_decl_handler() expects parameter 1 to be resource, null given in %s on line %d +NULL +Done + |