Skip to content

Commit 5be5a3d

Browse files
committed
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2: Test fixes for libxml2 2.12.0
2 parents 2751aa3 + 061058a commit 5be5a3d

12 files changed

+136
-7
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ PHP NEWS
66
. Fixed bug GH-12758 / GH-12768 (Invalid opline in OOM handlers within
77
ZEND_FUNC_GET_ARGS and ZEND_BIND_STATIC). (Florian Engelhardt)
88

9+
- LibXML:
10+
. Fixed test failures for libxml2 2.12.0. (nielsdos)
11+
912
- MySQLnd:
1013
. Avoid using uninitialised struct. (mikhainin)
1114
. Fixed bug GH-12791 (Possible dereference of NULL in MySQLnd debug code).

ext/dom/tests/DOMDocument_loadXML_error1.phpt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
--TEST--
22
Test DOMDocument::loadXML() detects not-well formed XML
3+
--SKIPIF--
4+
<?php
5+
if (LIBXML_VERSION >= 21200) die('skip libxml2 test variant for version < 2.12');
6+
?>
37
--DESCRIPTION--
48
This test verifies the method detects an opening and ending tag mismatch
59
Environment variables used in the test:
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
--TEST--
2+
Test DOMDocument::loadXML() detects not-well formed XML
3+
--SKIPIF--
4+
<?php
5+
if (LIBXML_VERSION < 21200) die('skip libxml2 test variant for version >= 2.12');
6+
?>
7+
--DESCRIPTION--
8+
This test verifies the method detects an opening and ending tag mismatch
9+
Environment variables used in the test:
10+
- XML_FILE: the xml file to load
11+
- LOAD_OPTIONS: the second parameter to pass to the method
12+
- EXPECTED_RESULT: the expected result
13+
--CREDITS--
14+
Antonio Diaz Ruiz <[email protected]>
15+
--EXTENSIONS--
16+
dom
17+
--ENV--
18+
XML_FILE=/not_well_formed.xml
19+
LOAD_OPTIONS=0
20+
EXPECTED_RESULT=0
21+
--FILE_EXTERNAL--
22+
domdocumentloadxml_test_method.inc
23+
--EXPECTF--
24+
Warning: DOMDocument::load%r(XML){0,1}%r(): Opening and ending tag mismatch: title line 5 and book %s
25+
26+
Warning: DOMDocument::load%r(XML){0,1}%r(): %rexpected '>'|Opening and ending tag mismatch: book line (4|5) and books%r %s

ext/dom/tests/DOMDocument_loadXML_error2_gte2_11.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Test DOMDocument::loadXML() detects not-well formed XML
33
--SKIPIF--
44
<?php
5-
if (LIBXML_VERSION < 21100) die('skip libxml2 test variant for version >= 2.11');
5+
if (LIBXML_VERSION < 21100 || LIBXML_VERSION >= 21200) die('skip libxml2 test variant for version >= 2.11 && <= 2.12');
66
?>
77
--DESCRIPTION--
88
This test verifies the method detects attributes values not closed between " or '
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
--TEST--
2+
Test DOMDocument::loadXML() detects not-well formed XML
3+
--SKIPIF--
4+
<?php
5+
if (LIBXML_VERSION < 21200) die('skip libxml2 test variant for version >= 2.12');
6+
?>
7+
--DESCRIPTION--
8+
This test verifies the method detects attributes values not closed between " or '
9+
Environment variables used in the test:
10+
- XML_FILE: the xml file to load
11+
- LOAD_OPTIONS: the second parameter to pass to the method
12+
- EXPECTED_RESULT: the expected result
13+
--CREDITS--
14+
Antonio Diaz Ruiz <[email protected]>
15+
--EXTENSIONS--
16+
dom
17+
--ENV--
18+
XML_FILE=/not_well_formed2.xml
19+
LOAD_OPTIONS=0
20+
EXPECTED_RESULT=0
21+
--FILE_EXTERNAL--
22+
domdocumentloadxml_test_method.inc
23+
--EXPECTF--
24+
Warning: DOMDocument::loadXML(): AttValue: " or ' expected in Entity, line: 4 in %s on line %d
25+
26+
Warning: DOMDocument::loadXML(): internal error: xmlParseStartTag: problem parsing attributes in Entity, line: 4 in %s on line %d
27+
28+
Warning: DOMDocument::loadXML(): Couldn't find end of Start Tag book line 4 in Entity, line: 4 in %s on line %d
29+
30+
Warning: DOMDocument::loadXML(): Opening and ending tag mismatch: books line 3 and book in Entity, line: 7 in %s on line %d

ext/dom/tests/DOMDocument_load_error1.phpt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
--TEST--
22
Test DOMDocument::load() detects not-well formed XML
3+
--SKIPIF--
4+
<?php
5+
if (LIBXML_VERSION >= 21200) die('skip libxml2 test variant for version < 2.12');
6+
?>
37
--DESCRIPTION--
48
This test verifies the method detects an opening and ending tag mismatch
59
Environment variables used in the test:
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
--TEST--
2+
Test DOMDocument::load() detects not-well formed XML
3+
--SKIPIF--
4+
<?php
5+
if (LIBXML_VERSION < 21200) die('skip libxml2 test variant for version >= 2.12');
6+
?>
7+
--DESCRIPTION--
8+
This test verifies the method detects an opening and ending tag mismatch
9+
Environment variables used in the test:
10+
- XML_FILE: the xml file to load
11+
- LOAD_OPTIONS: the second parameter to pass to the method
12+
- EXPECTED_RESULT: the expected result
13+
--CREDITS--
14+
Antonio Diaz Ruiz <[email protected]>
15+
--EXTENSIONS--
16+
dom
17+
--ENV--
18+
XML_FILE=/not_well_formed.xml
19+
LOAD_OPTIONS=0
20+
EXPECTED_RESULT=0
21+
--FILE_EXTERNAL--
22+
domdocumentload_test_method.inc
23+
--EXPECTF--
24+
Warning: DOMDocument::load%r(XML){0,1}%r(): Opening and ending tag mismatch: title line 5 and book %s
25+
26+
Warning: DOMDocument::load%r(XML){0,1}%r(): %rexpected '>'|Opening and ending tag mismatch: book line (4|5) and books%r %s

ext/dom/tests/DOMDocument_load_error2_gte2_11.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Test DOMDocument::load() detects not-well formed
33
--SKIPIF--
44
<?php
5-
if (LIBXML_VERSION < 21100) die('skip libxml2 test variant for version >= 2.11');
5+
if (LIBXML_VERSION < 21100 || LIBXML_VERSION >= 21200) die('skip libxml2 test variant for version >= 2.11 && <= 2.12');
66
?>
77
--DESCRIPTION--
88
This test verifies the method detects attributes values not closed between " or '
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
--TEST--
2+
Test DOMDocument::load() detects not-well formed
3+
--SKIPIF--
4+
<?php
5+
if (LIBXML_VERSION < 21200) die('skip libxml2 test variant for version >= 2.12');
6+
?>
7+
--DESCRIPTION--
8+
This test verifies the method detects attributes values not closed between " or '
9+
Environment variables used in the test:
10+
- XML_FILE: the xml file to load
11+
- LOAD_OPTIONS: the second parameter to pass to the method
12+
- EXPECTED_RESULT: the expected result
13+
--CREDITS--
14+
Antonio Diaz Ruiz <[email protected]>
15+
--EXTENSIONS--
16+
dom
17+
--ENV--
18+
XML_FILE=/not_well_formed2.xml
19+
LOAD_OPTIONS=0
20+
EXPECTED_RESULT=0
21+
--FILE_EXTERNAL--
22+
domdocumentload_test_method.inc
23+
--EXPECTF--
24+
Warning: DOMDocument::load(): AttValue: " or ' expected in %s on line %d
25+
26+
Warning: DOMDocument::load(): internal error: xmlParseStartTag: problem parsing attributes in %s on line %d
27+
28+
Warning: DOMDocument::load(): Couldn't find end of Start Tag book line 4 in %s on line %d
29+
30+
Warning: DOMDocument::load(): Opening and ending tag mismatch: books line 3 and book in %s on line %d

ext/dom/tests/DOMNode_isEqualNode.phpt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
DOMNode::isEqualNode()
33
--EXTENSIONS--
44
dom
5+
--SKIPIF--
6+
<?php
7+
if (LIBXML_VERSION >= 21200 && LIBXML_VERSION <= 21201) {
8+
die("xfail Broken for libxml2 2.12.0 - 2.12.1 see https://gitlab.gnome.org/GNOME/libxml2/-/issues/634");
9+
}
10+
?>
511
--FILE--
612
<?php
713

ext/xml/tests/bug81351.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ $code = xml_get_error_code($parser);
2121
$error = xml_error_string($code);
2222
echo "xml_parse returned $success, xml_get_error_code = $code, xml_error_string = $error\r\n";
2323
?>
24-
--EXPECT--
24+
--EXPECTF--
2525
xml_parse returned 1, xml_get_error_code = 0, xml_error_string = No error
26-
xml_parse returned 0, xml_get_error_code = 5, xml_error_string = Invalid document end
26+
%rxml_parse returned 0, xml_get_error_code = 5, xml_error_string = Invalid document end|xml_parse returned 0, xml_get_error_code = 77, xml_error_string = Tag not finished%r

ext/xml/tests/xml_error_string_basic.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ foreach ($xmls as $xml) {
2121
xml_parser_free($xml_parser);
2222
}
2323
?>
24-
--EXPECT--
25-
int(5)
26-
string(20) "Invalid document end"
24+
--EXPECTF--
25+
int(%r5|77%r)
26+
string(%d) %r"Invalid document end"|"Tag not finished"%r
2727
int(47)
2828
string(35) "Processing Instruction not finished"
2929
int(57)

0 commit comments

Comments
 (0)