Skip to content

Commit 7a0e947

Browse files
committed
Fix tests for libxml2 2.13.2
1 parent a0cd0cb commit 7a0e947

11 files changed

+19
-28
lines changed

ext/dom/tests/DOMDocument_loadHTMLfile_error1.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ $result = $doc->loadHTMLFile(__DIR__ . "/ffff/test.html");
1313
assert($result === false);
1414
?>
1515
--EXPECTF--
16-
%r(PHP ){0,1}%rWarning: DOMDocument::loadHTMLFile(): I/O warning : failed to load external entity %s
16+
%r(PHP ){0,1}%rWarning: DOMDocument::loadHTMLFile(): I/O %s

ext/dom/tests/DOMDocument_loadXML_error2_gte2_12.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ domdocumentloadxml_test_method.inc
2323
--EXPECTF--
2424
Warning: DOMDocument::loadXML(): AttValue: " or ' expected in Entity, line: 4 in %s on line %d
2525

26-
Warning: DOMDocument::loadXML(): internal error: xmlParseStartTag: problem parsing attributes in Entity, line: 4 in %s on line %d
26+
Warning: DOMDocument::loadXML():%sattributes%s
2727

2828
Warning: DOMDocument::loadXML(): Couldn't find end of Start Tag book line 4 in Entity, line: 4 in %s on line %d
2929

ext/dom/tests/DOMDocument_load_error2_gte2_12.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ domdocumentload_test_method.inc
2323
--EXPECTF--
2424
Warning: DOMDocument::load(): AttValue: " or ' expected in %s on line %d
2525

26-
Warning: DOMDocument::load(): internal error: xmlParseStartTag: problem parsing attributes in %s on line %d
26+
Warning: DOMDocument::load():%sattributes%s
2727

2828
Warning: DOMDocument::load(): Couldn't find end of Start Tag book line 4 in %s on line %d
2929

ext/dom/tests/DOMDocument_relaxNGValidate_error2.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ $result = $doc->relaxNGValidate($rng);
2020
var_dump($result);
2121
?>
2222
--EXPECTF--
23-
Warning: DOMDocument::relaxNGValidate(): I/O warning : failed to load external entity "%s/foo.rng" in %s on line %d
23+
Warning: DOMDocument::relaxNGValidate(): I/O %s : failed to load %s
2424

2525
Warning: DOMDocument::relaxNGValidate(): xmlRelaxNGParse: could not load %s/foo.rng in %s on line %d
2626

ext/dom/tests/DOMDocument_schemaValidate_error5.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var_dump($result);
1717

1818
?>
1919
--EXPECTF--
20-
Warning: DOMDocument::schemaValidate(): I/O warning : failed to load external entity "%snon-existent-file" in %s on line %d
20+
Warning: DOMDocument::schemaValidate(): I/O %s : failed to load %s
2121

2222
Warning: DOMDocument::schemaValidate(): Failed to locate the main schema resource at '%snon-existent-file'. in %s on line %d
2323

ext/dom/tests/DOMEntityReference_predefined_free.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ dom
77
$ref = new DOMEntityReference("amp");
88
var_dump($ref);
99
?>
10-
--EXPECT--
10+
--EXPECTF--
1111
object(DOMEntityReference)#1 (17) {
1212
["nodeName"]=>
1313
string(3) "amp"
@@ -42,5 +42,5 @@ object(DOMEntityReference)#1 (17) {
4242
["baseURI"]=>
4343
NULL
4444
["textContent"]=>
45-
string(0) ""
45+
string(%d) "%S"
4646
}

ext/dom/tests/DOMXPath_constructor_registered_functions.phpt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,17 @@ $xpath->__construct($dom, true);
3535
echo "=== Second run ===\n";
3636

3737
$xpath->registerNamespace('foo', 'urn:foo');
38-
$xpath->query('//*[foo:test()]');
38+
// Note: since libxml2 commit aca16fb3d45e0b2c45364ffc1cea8eb4abaca87d this only outputs 1 warning. This seems intentional.
39+
// Easiest workaround is silencing the warnings
40+
@$xpath->query('//*[foo:test()]');
3941
$xpath->registerPhpFunctionNS('urn:foo', 'test', [new Test, 'test']);
4042
$xpath->query('//*[foo:test()]');
4143

4244
?>
43-
--EXPECTF--
45+
--EXPECT--
4446
=== First run ===
4547
=== Reconstruct ===
4648
destruct
4749
=== Second run ===
48-
49-
Warning: DOMXPath::query(): xmlXPathCompOpEval: function test not found in %s on line %d
50-
51-
Warning: DOMXPath::query(): Unregistered function in %s on line %d
5250
test
5351
destruct

ext/dom/tests/dom_create_element.phpt

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -251,14 +251,10 @@ try {
251251
print $e->getMessage() . "\n";
252252
}
253253

254-
/* This isn't because the xml namespace isn't there and we can't create it */
255-
print "29 DOMElement::__construct('xml:valid', '', 'http://www.w3.org/XML/1998/namespace')\n";
256-
try {
257-
$element = new DomElement('xml:valid', '', 'http://www.w3.org/XML/1998/namespace');
258-
print "valid\n";
259-
} catch (Exception $e) {
260-
print $e->getMessage() . "\n";
261-
}
254+
/* There used to be a 29 here that tested DOMElement::__construct('xml:valid', '', 'http://www.w3.org/XML/1998/namespace').
255+
* 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
256+
* a document. Starting from libxml2 version 2.13 it does actually work because the XML namespace is statically defined.
257+
* The behaviour from version 2.13 is actually the desired behaviour anyway. */
262258

263259

264260
/* the qualifiedName or its prefix is "xmlns" and the namespaceURI is
@@ -378,8 +374,6 @@ Namespace Error
378374
Namespace Error
379375
28 DOMDocument::createElementNS('http://www.w3.org/XML/1998/namespace', 'xml:valid')
380376
valid
381-
29 DOMElement::__construct('xml:valid', '', 'http://www.w3.org/XML/1998/namespace')
382-
Namespace Error
383377
30 DOMDocument::createElementNS('http://wrong.namespaceURI.com', 'xmlns:valid')
384378
Namespace Error
385379
31 DOMElement::__construct('xmlns:valid', '', 'http://wrong.namespaceURI.com')

ext/dom/tests/modern/spec/attribute_entity_expansion_legacy.phpt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ dom
77
$doc = new DOMDocument;
88
$elt = $doc->createElement('elt');
99
$doc->appendChild($elt);
10-
$elt->setAttribute('a','&');
10+
// Note: since libxml2 commit aca16fb3d45e0b2c45364ffc1cea8eb4abaca87d this no longer explicitly warns. This seems intentional.
11+
@$elt->setAttribute('a','&');
1112
print $doc->saveXml($elt) . "\n";
1213

1314
$attr = $elt->getAttributeNode('a');
@@ -41,8 +42,6 @@ print $doc->saveXml($elt) . "\n";
4142
<elt a="&amp;"/>
4243
<elt a=""/>
4344

44-
Warning: main(): unterminated entity reference in %s on line %d
45-
4645
<elt a=""/>
4746
&
4847
<elt a="&amp;"/>

ext/dom/tests/modern/xml/XMLDocument_fromFile_02.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Dom\XMLDocument::createFromFile("\\0");
99

1010
?>
1111
--EXPECTF--
12-
Warning: Dom\XMLDocument::createFromFile(): I/O warning : failed to load external entity "%s" in %s on line %d
12+
Warning: Dom\XMLDocument::createFromFile(): I/O %s : failed to load %s
1313

1414
Fatal error: Uncaught Exception: Cannot open file '\0' in %s:%d
1515
Stack trace:

ext/simplexml/tests/bug79971_1.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ var_dump($sxe->asXML("$uri.out%00foo"));
2222
--EXPECTF--
2323
Warning: simplexml_load_file(): URI must not contain percent-encoded NUL bytes in %s on line %d
2424

25-
Warning: simplexml_load_file(): I/O warning : failed to load external entity "%s/bug79971_1.xml%%r00%rfoo" in %s on line %d
25+
Warning: simplexml_load_file(): I/O warning : failed to load %s
2626
bool(false)
2727

2828
Warning: SimpleXMLElement::asXML(): URI must not contain percent-encoded NUL bytes in %s on line %d

0 commit comments

Comments
 (0)