1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
--TEST--
xml_parser_set_option(): Setting options to invalid values
--EXTENSIONS--
xml
--FILE--
<?php
$xmlParser = xml_parser_create();
echo "Case folding\n";
try {
xml_parser_set_option($xmlParser, XML_OPTION_CASE_FOLDING, []);
} catch (ValueError $exception) {
echo $exception->getMessage() . "\n";
}
try {
xml_parser_set_option($xmlParser, XML_OPTION_CASE_FOLDING, new stdClass());
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}
echo "Skip Whitespace\n";
try {
xml_parser_set_option($xmlParser, XML_OPTION_SKIP_WHITE, []);
} catch (ValueError $exception) {
echo $exception->getMessage() . "\n";
}
try {
xml_parser_set_option($xmlParser, XML_OPTION_SKIP_WHITE, new stdClass());
} catch (TypeError $exception) {
echo $exception->getMessage() . "\n";
}
echo "Tag Start\n";
xml_parser_set_option($xmlParser, XML_OPTION_SKIP_TAGSTART, -5);
xml_parser_set_option($xmlParser, XML_OPTION_SKIP_TAGSTART, []);
xml_parser_set_option($xmlParser, XML_OPTION_SKIP_TAGSTART, new stdClass());
echo "Encodings\n";
try {
xml_parser_set_option($xmlParser, XML_OPTION_TARGET_ENCODING, 'Invalid Encoding');
} catch (ValueError $exception) {
echo $exception->getMessage() . "\n";
}
try {
xml_parser_set_option($xmlParser, XML_OPTION_TARGET_ENCODING, []);
} catch (ValueError $exception) {
echo $exception->getMessage() . "\n";
}
try {
xml_parser_set_option($xmlParser, XML_OPTION_TARGET_ENCODING, new stdClass());
} catch (Error $exception) {
echo $exception::class, ': ', $exception->getMessage() . "\n";
}
?>
--EXPECTF--
Case folding
Warning: xml_parser_set_option(): Argument #3 ($value) must be of type string|int|bool, array given in %s on line %d
Warning: xml_parser_set_option(): Argument #3 ($value) must be of type string|int|bool, stdClass given in %s on line %d
Skip Whitespace
Warning: xml_parser_set_option(): Argument #3 ($value) must be of type string|int|bool, array given in %s on line %d
Warning: xml_parser_set_option(): Argument #3 ($value) must be of type string|int|bool, stdClass given in %s on line %d
Tag Start
Warning: xml_parser_set_option(): Argument #3 ($value) must be between 0 and 2147483647 for option XML_OPTION_SKIP_TAGSTART in %s on line %d
Warning: xml_parser_set_option(): Argument #3 ($value) must be of type string|int|bool, array given in %s on line %d
Warning: xml_parser_set_option(): Argument #3 ($value) must be of type string|int|bool, stdClass given in %s on line %d
Warning: Object of class stdClass could not be converted to int in %s on line %d
Encodings
xml_parser_set_option(): Argument #3 ($value) is not a supported target encoding
Warning: xml_parser_set_option(): Argument #3 ($value) must be of type string|int|bool, array given in %s on line %d
Warning: Array to string conversion in %s on line %d
xml_parser_set_option(): Argument #3 ($value) is not a supported target encoding
Warning: xml_parser_set_option(): Argument #3 ($value) must be of type string|int|bool, stdClass given in %s on line %d
Error: Object of class stdClass could not be converted to string
|