diff --git a/ext/dom/tests/DOMDocument_loadHTMLfile_error1.phpt b/ext/dom/tests/DOMDocument_loadHTMLfile_error1.phpt
index 08bf361216f..dabf396eaea 100644
--- a/ext/dom/tests/DOMDocument_loadHTMLfile_error1.phpt
+++ b/ext/dom/tests/DOMDocument_loadHTMLfile_error1.phpt
@@ -13,4 +13,4 @@ $result = $doc->loadHTMLFile(__DIR__ . "/ffff/test.html");
assert($result === false);
?>
--EXPECTF--
-%r(PHP ){0,1}%rWarning: DOMDocument::loadHTMLFile(): I/O warning : failed to load external entity %s
+%r(PHP ){0,1}%rWarning: DOMDocument::loadHTMLFile(): I/O %s
diff --git a/ext/dom/tests/DOMDocument_loadXML_error2_gte2_12.phpt b/ext/dom/tests/DOMDocument_loadXML_error2_gte2_12.phpt
index 6a3ff5841f5..d84d690c715 100644
--- a/ext/dom/tests/DOMDocument_loadXML_error2_gte2_12.phpt
+++ b/ext/dom/tests/DOMDocument_loadXML_error2_gte2_12.phpt
@@ -23,7 +23,7 @@ domdocumentloadxml_test_method.inc
--EXPECTF--
Warning: DOMDocument::loadXML(): AttValue: " or ' expected in Entity, line: 4 in %s on line %d
-Warning: DOMDocument::loadXML(): internal error: xmlParseStartTag: problem parsing attributes in Entity, line: 4 in %s on line %d
+Warning: DOMDocument::loadXML():%sattributes%s
Warning: DOMDocument::loadXML(): Couldn't find end of Start Tag book line 4 in Entity, line: 4 in %s on line %d
diff --git a/ext/dom/tests/DOMDocument_load_error2_gte2_12.phpt b/ext/dom/tests/DOMDocument_load_error2_gte2_12.phpt
index 4fadf417361..aaab30ed645 100644
--- a/ext/dom/tests/DOMDocument_load_error2_gte2_12.phpt
+++ b/ext/dom/tests/DOMDocument_load_error2_gte2_12.phpt
@@ -23,7 +23,7 @@ domdocumentload_test_method.inc
--EXPECTF--
Warning: DOMDocument::load(): AttValue: " or ' expected in %s on line %d
-Warning: DOMDocument::load(): internal error: xmlParseStartTag: problem parsing attributes in %s on line %d
+Warning: DOMDocument::load():%sattributes%s
Warning: DOMDocument::load(): Couldn't find end of Start Tag book line 4 in %s on line %d
diff --git a/ext/dom/tests/DOMDocument_relaxNGValidate_error2.phpt b/ext/dom/tests/DOMDocument_relaxNGValidate_error2.phpt
index 1ad46e014a0..cb506f70789 100644
--- a/ext/dom/tests/DOMDocument_relaxNGValidate_error2.phpt
+++ b/ext/dom/tests/DOMDocument_relaxNGValidate_error2.phpt
@@ -20,7 +20,7 @@ $result = $doc->relaxNGValidate($rng);
var_dump($result);
?>
--EXPECTF--
-Warning: DOMDocument::relaxNGValidate(): I/O warning : failed to load external entity "%s/foo.rng" in %s on line %d
+Warning: DOMDocument::relaxNGValidate(): I/O %s : failed to load %s
Warning: DOMDocument::relaxNGValidate(): xmlRelaxNGParse: could not load %s/foo.rng in %s on line %d
diff --git a/ext/dom/tests/DOMDocument_saveHTMLFile_basic.phpt b/ext/dom/tests/DOMDocument_saveHTMLFile_basic.phpt
index cf392c0262f..32f1a3c36e2 100644
--- a/ext/dom/tests/DOMDocument_saveHTMLFile_basic.phpt
+++ b/ext/dom/tests/DOMDocument_saveHTMLFile_basic.phpt
@@ -5,6 +5,10 @@ Knut Urdalen
#PHPTestFest2009 Norway 2009-06-09 \o/
--EXTENSIONS--
dom
+--SKIPIF--
+= 21300) die("skip see https://gitlab.gnome.org/GNOME/libxml2/-/issues/756");
+?>
--FILE--
#PHPTestFest2009 Norway 2009-06-09 \o/
--EXTENSIONS--
dom
+--SKIPIF--
+= 21300) die("skip see https://gitlab.gnome.org/GNOME/libxml2/-/issues/756");
+?>
--FILE--
+#PHPTestFest2009 Norway 2009-06-09 \o/
+--EXTENSIONS--
+dom
+--SKIPIF--
+
+--FILE--
+formatOutput = true;
+$root = $doc->createElement('html');
+$root = $doc->appendChild($root);
+$head = $doc->createElement('head');
+$head = $root->appendChild($head);
+$title = $doc->createElement('title');
+$title = $head->appendChild($title);
+$text = $doc->createTextNode('This is the title');
+$text = $title->appendChild($text);
+$bytes = $doc->saveHTMLFile($filename);
+var_dump($bytes);
+echo file_get_contents($filename);
+unlink($filename);
+?>
+--EXPECT--
+int(59)
+This is the title
diff --git a/ext/dom/tests/DOMDocument_saveHTML_basic_gte_2_13.phpt b/ext/dom/tests/DOMDocument_saveHTML_basic_gte_2_13.phpt
new file mode 100644
index 00000000000..c0be105253d
--- /dev/null
+++ b/ext/dom/tests/DOMDocument_saveHTML_basic_gte_2_13.phpt
@@ -0,0 +1,31 @@
+--TEST--
+DOMDocument::saveHTMLFile() should dump the internal document into a file using HTML formatting
+--CREDITS--
+Knut Urdalen
+#PHPTestFest2009 Norway 2009-06-09 \o/
+--EXTENSIONS--
+dom
+--SKIPIF--
+
+--FILE--
+createElement('html');
+$root = $doc->appendChild($root);
+$head = $doc->createElement('head');
+$head = $root->appendChild($head);
+$title = $doc->createElement('title');
+$title = $head->appendChild($title);
+$text = $doc->createTextNode('This is the title');
+$text = $title->appendChild($text);
+$bytes = $doc->saveHTMLFile($filename);
+var_dump($bytes);
+echo file_get_contents($filename);
+unlink($filename);
+?>
+--EXPECT--
+int(59)
+This is the title
diff --git a/ext/dom/tests/DOMDocument_schemaValidate_error5.phpt b/ext/dom/tests/DOMDocument_schemaValidate_error5.phpt
index 3b277fd6cdb..dd002ea14b7 100644
--- a/ext/dom/tests/DOMDocument_schemaValidate_error5.phpt
+++ b/ext/dom/tests/DOMDocument_schemaValidate_error5.phpt
@@ -17,7 +17,7 @@ var_dump($result);
?>
--EXPECTF--
-Warning: DOMDocument::schemaValidate(): I/O warning : failed to load external entity "%snon-existent-file" in %s on line %d
+Warning: DOMDocument::schemaValidate(): I/O %s : failed to load %s
Warning: DOMDocument::schemaValidate(): Failed to locate the main schema resource at '%snon-existent-file'. in %s on line %d
diff --git a/ext/dom/tests/DOMEntityReference_predefined_free.phpt b/ext/dom/tests/DOMEntityReference_predefined_free.phpt
index 4b971d83703..46e54e1b7d3 100644
--- a/ext/dom/tests/DOMEntityReference_predefined_free.phpt
+++ b/ext/dom/tests/DOMEntityReference_predefined_free.phpt
@@ -7,7 +7,7 @@ dom
$ref = new DOMEntityReference("amp");
var_dump($ref);
?>
---EXPECT--
+--EXPECTF--
object(DOMEntityReference)#1 (17) {
["nodeName"]=>
string(3) "amp"
@@ -42,5 +42,5 @@ object(DOMEntityReference)#1 (17) {
["baseURI"]=>
NULL
["textContent"]=>
- string(0) ""
+ string(%d) "%S"
}
diff --git a/ext/dom/tests/DOMXPath_constructor_registered_functions.phpt b/ext/dom/tests/DOMXPath_constructor_registered_functions.phpt
index 1fd498a5287..8a90cffbba2 100644
--- a/ext/dom/tests/DOMXPath_constructor_registered_functions.phpt
+++ b/ext/dom/tests/DOMXPath_constructor_registered_functions.phpt
@@ -35,19 +35,17 @@ $xpath->__construct($dom, true);
echo "=== Second run ===\n";
$xpath->registerNamespace('foo', 'urn:foo');
-$xpath->query('//*[foo:test()]');
+// Note: since libxml2 commit aca16fb3d45e0b2c45364ffc1cea8eb4abaca87d this only outputs 1 warning. This seems intentional.
+// Easiest workaround is silencing the warnings
+@$xpath->query('//*[foo:test()]');
$xpath->registerPhpFunctionNS('urn:foo', 'test', [new Test, 'test']);
$xpath->query('//*[foo:test()]');
?>
---EXPECTF--
+--EXPECT--
=== First run ===
=== Reconstruct ===
destruct
=== Second run ===
-
-Warning: DOMXPath::query(): xmlXPathCompOpEval: function test not found in %s on line %d
-
-Warning: DOMXPath::query(): Unregistered function in %s on line %d
test
destruct
diff --git a/ext/dom/tests/dom_create_element.phpt b/ext/dom/tests/dom_create_element.phpt
index 82d73826da4..19acb5614d5 100644
--- a/ext/dom/tests/dom_create_element.phpt
+++ b/ext/dom/tests/dom_create_element.phpt
@@ -251,14 +251,10 @@ try {
print $e->getMessage() . "\n";
}
-/* This isn't because the xml namespace isn't there and we can't create it */
-print "29 DOMElement::__construct('xml:valid', '', 'http://www.w3.org/XML/1998/namespace')\n";
-try {
- $element = new DomElement('xml:valid', '', 'http://www.w3.org/XML/1998/namespace');
- print "valid\n";
-} catch (Exception $e) {
- print $e->getMessage() . "\n";
-}
+/* There used to be a 29 here that tested DOMElement::__construct('xml:valid', '', 'http://www.w3.org/XML/1998/namespace').
+ * In libxml2 version 2.12 or prior this didn't work because the xml namespace isn't there and you can't create it without
+ * a document. Starting from libxml2 version 2.13 it does actually work because the XML namespace is statically defined.
+ * The behaviour from version 2.13 is actually the desired behaviour anyway. */
/* the qualifiedName or its prefix is "xmlns" and the namespaceURI is
@@ -378,8 +374,6 @@ Namespace Error
Namespace Error
28 DOMDocument::createElementNS('http://www.w3.org/XML/1998/namespace', 'xml:valid')
valid
-29 DOMElement::__construct('xml:valid', '', 'http://www.w3.org/XML/1998/namespace')
-Namespace Error
30 DOMDocument::createElementNS('http://wrong.namespaceURI.com', 'xmlns:valid')
Namespace Error
31 DOMElement::__construct('xmlns:valid', '', 'http://wrong.namespaceURI.com')
diff --git a/ext/dom/tests/modern/html/interactions/HTMLDocument_documentURI.phpt b/ext/dom/tests/modern/html/interactions/HTMLDocument_documentURI.phpt
index 76375afe129..4aedec9ecb9 100644
--- a/ext/dom/tests/modern/html/interactions/HTMLDocument_documentURI.phpt
+++ b/ext/dom/tests/modern/html/interactions/HTMLDocument_documentURI.phpt
@@ -42,6 +42,6 @@ var_dump($dom->documentURI);
?>
--EXPECTF--
-string(%d) "file://%stest%20foo.html"
+string(%d) "file://%stest%sfoo.html"
string(12) "php://memory"
string(16) "dummy://foo/ bar"
diff --git a/ext/dom/tests/modern/spec/attribute_entity_expansion_legacy.phpt b/ext/dom/tests/modern/spec/attribute_entity_expansion_legacy.phpt
index 72aa18c9da1..f2b00c9ad2b 100644
--- a/ext/dom/tests/modern/spec/attribute_entity_expansion_legacy.phpt
+++ b/ext/dom/tests/modern/spec/attribute_entity_expansion_legacy.phpt
@@ -18,7 +18,8 @@ print $doc->saveXml($elt) . "\n";
$attr->removeChild($attr->firstChild);
print $doc->saveXml($elt) . "\n";
-$attr->nodeValue = '&';
+// Note: since libxml2 commit aca16fb3d45e0b2c45364ffc1cea8eb4abaca87d this no longer explicitly warns. This seems intentional.
+@$attr->nodeValue = '&';
print "$attr->nodeValue\n";
print $doc->saveXml($elt) . "\n";
@@ -41,8 +42,6 @@ print $doc->saveXml($elt) . "\n";
-Warning: main(): unterminated entity reference in %s on line %d
-
&
diff --git a/ext/dom/tests/modern/xml/XMLDocument_documentURI.phpt b/ext/dom/tests/modern/xml/XMLDocument_documentURI.phpt
index 9b65df78742..59399e5116b 100644
--- a/ext/dom/tests/modern/xml/XMLDocument_documentURI.phpt
+++ b/ext/dom/tests/modern/xml/XMLDocument_documentURI.phpt
@@ -10,4 +10,4 @@ var_dump($dom->documentURI);
?>
--EXPECTF--
-string(%d) "file://%stest%20foo.xml"
+string(%d) "file://%stest%sfoo.xml"
diff --git a/ext/dom/tests/modern/xml/XMLDocument_fromFile_02.phpt b/ext/dom/tests/modern/xml/XMLDocument_fromFile_02.phpt
index 1fccbd5ed2b..4d376564b68 100644
--- a/ext/dom/tests/modern/xml/XMLDocument_fromFile_02.phpt
+++ b/ext/dom/tests/modern/xml/XMLDocument_fromFile_02.phpt
@@ -9,7 +9,7 @@ Dom\XMLDocument::createFromFile("\\0");
?>
--EXPECTF--
-Warning: Dom\XMLDocument::createFromFile(): I/O warning : failed to load external entity "%s" in %s on line %d
+Warning: Dom\XMLDocument::createFromFile(): I/O %s : failed to load %s
Fatal error: Uncaught Exception: Cannot open file '\0' in %s:%d
Stack trace:
diff --git a/ext/simplexml/tests/bug79971_1.phpt b/ext/simplexml/tests/bug79971_1.phpt
index 2ee07c81822..df38ddf20e8 100644
--- a/ext/simplexml/tests/bug79971_1.phpt
+++ b/ext/simplexml/tests/bug79971_1.phpt
@@ -22,7 +22,7 @@ var_dump($sxe->asXML("$uri.out%00foo"));
--EXPECTF--
Warning: simplexml_load_file(): URI must not contain percent-encoded NUL bytes in %s on line %d
-Warning: simplexml_load_file(): I/O warning : failed to load external entity "%s/bug79971_1.xml%%r00%rfoo" in %s on line %d
+Warning: simplexml_load_file(): I/O warning : failed to load %s
bool(false)
Warning: SimpleXMLElement::asXML(): URI must not contain percent-encoded NUL bytes in %s on line %d
diff --git a/ext/soap/tests/bugs/bug42151.phpt b/ext/soap/tests/bugs/bug42151.phpt
index 6f5c0c42077..2f9c1830ad3 100644
--- a/ext/soap/tests/bugs/bug42151.phpt
+++ b/ext/soap/tests/bugs/bug42151.phpt
@@ -25,8 +25,8 @@ try {
}
echo "ok\n";
?>
---EXPECT--
-SOAP-ERROR: Parsing WSDL: Couldn't load from 'httpx://' : failed to load external entity "httpx://"
+--EXPECTF--
+SOAP-ERROR: Parsing WSDL: Couldn't load from 'httpx://' : failed to load %s
ok
I don't get executed either.