Skip to content

Commit 0fd226c

Browse files
committed
Update DOM test to work around libxml2 bug
As reported in GH-12024, the test fails in the encoding part of the test file. This is due to a libxml2 bug (that's been fixed in modern versions, but of course various systems and distros are always behind). The goal of this part of the test is to check if an encoding declaration is outputted. So the actual encoding used doesn't matter. Switch to UTF-8, which seems to always work, to work around the issue.
1 parent 462792e commit 0fd226c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ext/dom/tests/DOMDocument_saveXML_XML_SAVE_NO_DECL.phpt

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ $doc->loadXML('<root>é</root>');
1313

1414
echo $doc->saveXML(options: 0);
1515
echo $doc->saveXML(options: LIBXML_NOXMLDECL);
16-
$doc->encoding = "BIG5";
16+
// Explicit encoding test, to ensure no encoding declaration.
17+
$doc->encoding = "UTF-8";
1718
echo $doc->saveXML(options: LIBXML_NOXMLDECL);
1819

1920
// Edge case
@@ -24,5 +25,5 @@ var_dump($doc->saveXML(options: LIBXML_NOXMLDECL));
2425
<?xml version="1.0"?>
2526
<root>&#xE9;</root>
2627
<root>&#xE9;</root>
27-
<root>&#233;</root>
28+
<root>é</root>
2829
string(0) ""

0 commit comments

Comments
 (0)