From e4366607f771a4a361bde4f1a38fdcbee9a3935c Mon Sep 17 00:00:00 2001
From: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
Date: Tue, 22 Aug 2023 22:32:02 +0200
Subject: [PATCH] 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.
---
ext/dom/tests/DOMDocument_saveXML_XML_SAVE_NO_DECL.phpt | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/ext/dom/tests/DOMDocument_saveXML_XML_SAVE_NO_DECL.phpt b/ext/dom/tests/DOMDocument_saveXML_XML_SAVE_NO_DECL.phpt
index 2a51b88cd59f5..f9c3e67af78a3 100644
--- a/ext/dom/tests/DOMDocument_saveXML_XML_SAVE_NO_DECL.phpt
+++ b/ext/dom/tests/DOMDocument_saveXML_XML_SAVE_NO_DECL.phpt
@@ -13,7 +13,8 @@ $doc->loadXML('é');
echo $doc->saveXML(options: 0);
echo $doc->saveXML(options: LIBXML_NOXMLDECL);
-$doc->encoding = "BIG5";
+// Explicit encoding test, to ensure no encoding declaration.
+$doc->encoding = "UTF-8";
echo $doc->saveXML(options: LIBXML_NOXMLDECL);
// Edge case
@@ -24,5 +25,5 @@ var_dump($doc->saveXML(options: LIBXML_NOXMLDECL));
é
é
-é
+é
string(0) ""