mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00

* Avoid passing NULL to xmlSwitchToEncoding This otherwise switches to UTF-8 on libxml2 2.12.0 * Split tests for different error reporting behaviour in libxml2 2.12.0 * Avoid deprecation warnings for libxml2 2.12.0 We can't fully get rid of the parser globals as there are still APIs that implicitly use them. * Temporarily disable part of test for libxml 2.12.0 regression See https://gitlab.gnome.org/GNOME/libxml2/-/issues/634 * Review fixes * [ci skip] Update test description
34 lines
795 B
PHP
34 lines
795 B
PHP
--TEST--
|
|
xml_error_string() - Basic test on 5 error codes
|
|
--EXTENSIONS--
|
|
xml
|
|
--FILE--
|
|
<?php
|
|
$xmls = array(
|
|
'<?xml version="1.0"?><element>',
|
|
'<?xml>',
|
|
'<?xml version="dummy">',
|
|
'<?xml?>',
|
|
'<?xml version="1.0"?><elem></element>',
|
|
);
|
|
|
|
foreach ($xmls as $xml) {
|
|
$xml_parser = xml_parser_create();
|
|
if (!xml_parse($xml_parser, $xml, true)) {
|
|
var_dump(xml_get_error_code($xml_parser));
|
|
var_dump(xml_error_string(xml_get_error_code($xml_parser)));
|
|
}
|
|
xml_parser_free($xml_parser);
|
|
}
|
|
?>
|
|
--EXPECTF--
|
|
int(%r5|77%r)
|
|
string(%d) %r"Invalid document end"|"Tag not finished"%r
|
|
int(47)
|
|
string(35) "Processing Instruction not finished"
|
|
int(57)
|
|
string(28) "XML declaration not finished"
|
|
int(64)
|
|
string(17) "Reserved XML Name"
|
|
int(76)
|
|
string(14) "Mismatched tag"
|