testing/php8: add patch for new libxml

This commit is contained in:
Andy Postnikov 2023-04-30 00:23:57 +02:00
parent f227ac16e3
commit fafa25f094
3 changed files with 269 additions and 9 deletions

View File

@ -26,7 +26,7 @@
pkgname=php8
_pkgreal=php
pkgver=8.0.28
pkgrel=2
pkgrel=3
_apiver=20200930
_suffix=${pkgname#php}
# Is this package the default (latest) PHP version?
@ -110,6 +110,7 @@ source="https://php.net/distributions/$_pkgreal-$pkgver.tar.xz
fix-tests-openssl3-2.patch
fix-tests-openssl3-3.patch
fix-icu72.patch
fix-libxml-2-11.patch
"
builddir="$srcdir/$_pkgreal-$pkgver"
@ -649,7 +650,7 @@ d66e41cdccc332fccaf03bb24356652b17be5267cba5a47d80f1b74732b674f6a23c91e4a151ca44
8a9a63cddfd9bdde23db85a7be0711e14688bab35b580abd0184d370c54de80b72cbdeb369570cd23927154984f024eaad5d222d53d9e19130fb2e8758dd4540 php8-fpm.initd
cd3a96d3febde3b6657ed80ff58945641443e84e5e0fd3d9df29e640e9549bc452a3412f1999fa02ae1ee2b64c08040998fa75805f67e0252741c376e26e1c3c php8-fpm.logrotate
95f536addfbb28fbca8b14da46d95a3595369d6e98d345f55f0fda1b12bdefd1579a27505424e7d1088a987d330798253cec9bd42b544bb567189cba746217c7 php8-module.conf
5e11c97775567bd30a120d75f20be71b25db0cd6ae4ec96ef002e3c4668b35a2e1ba422fd0df28a1a5aebc12d796142db822284773c93c0092348159057b80cc disabled-tests.list
d93c4908efb946657ea7f84a063ecc004ab8755cd0e30d51a44d05f6ab2880e54901b7d62801fd9580d027fcf0b8046becfdbfa024a4e30b64d505413c723a96 disabled-tests.list
ec206639d076ddac6c2d1db697a5428ed3be979157db39417af7fbe6ab837e8dc00315ae0e55aea4f92f45ca5827c88cc4933099fad9c962f029ca81bef779d7 install-pear.patch
79f919ca110530cac2f1ed1e7a86e2c396c25022f00501b520b6bd2efa8eefd962df4ad25235b8a37d8a30d67d257baaf9dfb4041891206a5b15a9c895f1797d includedir.patch
b5d7e87df4f45171a185aec1d4cf96157b3c6b9ea9625237e31b0756220a12a64c260cc20c38bfb0146f11fca25c9c25be1981a922ecb14de5cc2965d29d8fe3 sharedir.patch
@ -662,4 +663,5 @@ fafebc840a4c8451e0a7844caa64f5d4a19410a1a9572df1b7fc1a35b881aa4a30c3e364c83a4d44
c4418ca451e60da1e00195738f06d8ddbc9ba6d10530fd1b9e4c9828bf8824f412c27b2af73b4905223cbf657821eb79c4433e16414c48adeebaa3796600e9b0 fix-tests-openssl3-2.patch
2e2cc726ebed5dde0237d7d5711072d601e59d25b2ee0351fe3a615f0c11c7756aa23e38c97d3c3f7c6dbe97696202a8609c777768be4e7b2fd126db6cf43436 fix-tests-openssl3-3.patch
706498ba14ef2657dbc40136c45382578c79b4ed31f1f313dfcf8e34ce0e59761a952ec1d2ec0ecdc07af50c2220600fd615da4bfe9d3778ab8066dad54b6660 fix-icu72.patch
1e13671f334b80d1bfb767ba3858a6fccdc571a7ce9b6b6f5fe5b8a96d45c82361f6a240c0ae601787a5505936de6c319c6352cf2a51513f35c23956c75d8b9a fix-libxml-2-11.patch
"

View File

@ -232,10 +232,3 @@ ext/openssl/tests/openssl_pkcs7_encrypt_basic.phpt
# icu 73
ext/intl/tests/calendar_clear_variation1.phpt
# libxml2 2.11.0
ext/dom/tests/DOMDocument_loadXML_error2.phpt
ext/dom/tests/DOMDocument_load_error2.phpt
ext/libxml/tests/bug61367-read_2.phpt
ext/libxml/tests/libxml_disable_entity_loader_2.phpt
ext/xml/tests/bug26614_libxml.phpt

View File

@ -0,0 +1,265 @@
Patch-Source: https://github.com/php/php-src/pull/11162
From 1b562ba032181a7967b1e2e118db893adcdbeaf1 Mon Sep 17 00:00:00 2001
From: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
Date: Sat, 29 Apr 2023 21:07:50 +0200
Subject: [PATCH] Fix GH-11160: Few tests failed building with new libxml
2.11.0
It's possible to categorise the failures into 2 categories:
- Changed error message. In this case we either duplicate the test and
modify the error message. Or if the change in error message is
small, we use the EXPECTF matchers to make the test compatible with both
old and new versions of libxml2.
- Missing warnings. This is caused by a change in libxml2 where the
parser started using SAX APIs internally [1]. In this case the
error_type passed to php_libxml_internal_error_handler() changed from
PHP_LIBXML_ERROR to PHP_LIBXML_CTX_WARNING because it internally
started to use the SAX handlers instead of the generic handlers.
However, for the SAX handlers the current input stack is empty, so
nothing is actually printed. I fixed this by falling back to a
regular warning without a filename & line number reference, which
mimicks the old behaviour. Furthermore, this change now also shows
an additional warning in a test which was previously hidden.
[1] https://gitlab.gnome.org/GNOME/libxml2/-/commit/9a82b94a94bd310db426edd453b0f38c6c8f69f5
---
.../DOMDocument_loadXML_error2_gte2_11.phpt | 34 +++++++
...> DOMDocument_loadXML_error2_pre2_11.phpt} | 4 +
.../DOMDocument_load_error2_gte2_11.phpt | 34 +++++++
...t => DOMDocument_load_error2_pre2_11.phpt} | 4 +
ext/libxml/libxml.c | 2 +
ext/libxml/tests/bug61367-read_2.phpt | 2 +-
.../tests/libxml_disable_entity_loader_2.phpt | 2 +-
...set_external_entity_loader_variation2.phpt | 2 +
ext/xml/tests/bug26614_libxml_gte2_11.phpt | 95 +++++++++++++++++++
...bxml.phpt => bug26614_libxml_pre2_11.phpt} | 1 +
10 files changed, 178 insertions(+), 2 deletions(-)
create mode 100644 ext/dom/tests/DOMDocument_loadXML_error2_gte2_11.phpt
rename ext/dom/tests/{DOMDocument_loadXML_error2.phpt => DOMDocument_loadXML_error2_pre2_11.phpt} (90%)
create mode 100644 ext/dom/tests/DOMDocument_load_error2_gte2_11.phpt
rename ext/dom/tests/{DOMDocument_load_error2.phpt => DOMDocument_load_error2_pre2_11.phpt} (90%)
create mode 100644 ext/xml/tests/bug26614_libxml_gte2_11.phpt
rename ext/xml/tests/{bug26614_libxml.phpt => bug26614_libxml_pre2_11.phpt} (96%)
diff --git a/ext/dom/tests/DOMDocument_loadXML_error2_gte2_11.phpt b/ext/dom/tests/DOMDocument_loadXML_error2_gte2_11.phpt
new file mode 100644
index 0000000000..ff5ceb3fbe
--- /dev/null
+++ b/ext/dom/tests/DOMDocument_loadXML_error2_gte2_11.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test DOMDocument::loadXML() detects not-well formed XML
+--SKIPIF--
+<?php
+if (LIBXML_VERSION < 21100) die('skip libxml2 test variant for version >= 2.11');
+?>
+--DESCRIPTION--
+This test verifies the method detects attributes values not closed between " or '
+Environment variables used in the test:
+- XML_FILE: the xml file to load
+- LOAD_OPTIONS: the second parameter to pass to the method
+- EXPECTED_RESULT: the expected result
+--CREDITS--
+Antonio Diaz Ruiz <dejalatele@gmail.com>
+--INI--
+assert.bail=true
+--EXTENSIONS--
+dom
+--ENV--
+XML_FILE=/not_well_formed2.xml
+LOAD_OPTIONS=0
+EXPECTED_RESULT=0
+--FILE_EXTERNAL--
+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(): Couldn't find end of Start Tag book line 4 in Entity, line: 4 in %s on line %d
+
+Warning: DOMDocument::loadXML(): Opening and ending tag mismatch: books line 3 and book in Entity, line: 7 in %s on line %d
+
+Warning: DOMDocument::loadXML(): Extra content at the end of the document in Entity, line: 8 in %s on line %d
diff --git a/ext/dom/tests/DOMDocument_loadXML_error2.phpt b/ext/dom/tests/DOMDocument_loadXML_error2_pre2_11.phpt
similarity index 89%
rename from ext/dom/tests/DOMDocument_loadXML_error2.phpt
rename to ext/dom/tests/DOMDocument_loadXML_error2_pre2_11.phpt
index 6d56a317ed..8337e1a752 100644
--- a/ext/dom/tests/DOMDocument_loadXML_error2.phpt
+++ b/ext/dom/tests/DOMDocument_loadXML_error2_pre2_11.phpt
@@ -11,7 +11,10 @@ Antonio Diaz Ruiz <dejalatele@gmail.com>
--INI--
assert.bail=true
--SKIPIF--
-<?php include('skipif.inc'); ?>
+<?php
+include('skipif.inc');
+if (LIBXML_VERSION >= 21100) die('skip libxml2 test variant for version < 2.11');
+?>
--ENV--
XML_FILE=/not_well_formed2.xml
LOAD_OPTIONS=0
diff --git a/ext/dom/tests/DOMDocument_load_error2_gte2_11.phpt b/ext/dom/tests/DOMDocument_load_error2_gte2_11.phpt
new file mode 100644
index 0000000000..32b6bf1611
--- /dev/null
+++ b/ext/dom/tests/DOMDocument_load_error2_gte2_11.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test DOMDocument::load() detects not-well formed
+--SKIPIF--
+<?php
+if (LIBXML_VERSION < 21100) die('skip libxml2 test variant for version >= 2.11');
+?>
+--DESCRIPTION--
+This test verifies the method detects attributes values not closed between " or '
+Environment variables used in the test:
+- XML_FILE: the xml file to load
+- LOAD_OPTIONS: the second parameter to pass to the method
+- EXPECTED_RESULT: the expected result
+--CREDITS--
+Antonio Diaz Ruiz <dejalatele@gmail.com>
+--INI--
+assert.bail=true
+--EXTENSIONS--
+dom
+--ENV--
+XML_FILE=/not_well_formed2.xml
+LOAD_OPTIONS=0
+EXPECTED_RESULT=0
+--FILE_EXTERNAL--
+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(): Couldn't find end of Start Tag book line 4 in %s on line %d
+
+Warning: DOMDocument::load(): Opening and ending tag mismatch: books line 3 and book in %s on line %d
+
+Warning: DOMDocument::load(): Extra content at the end of the document in %s on line %d
diff --git a/ext/dom/tests/DOMDocument_load_error2.phpt b/ext/dom/tests/DOMDocument_load_error2_pre2_11.phpt
similarity index 89%
rename from ext/dom/tests/DOMDocument_load_error2.phpt
rename to ext/dom/tests/DOMDocument_load_error2_pre2_11.phpt
index f450cf1654..eb4f4781c2 100644
--- a/ext/dom/tests/DOMDocument_load_error2.phpt
+++ b/ext/dom/tests/DOMDocument_load_error2_pre2_11.phpt
@@ -11,7 +11,10 @@ Antonio Diaz Ruiz <dejalatele@gmail.com>
--INI--
assert.bail=true
--SKIPIF--
-<?php include('skipif.inc'); ?>
+<?php
+include('skipif.inc');
+if (LIBXML_VERSION >= 21100) die('skip libxml2 test variant for version < 2.11');
+?>
--ENV--
XML_FILE=/not_well_formed2.xml
LOAD_OPTIONS=0
diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c
index 73486ae253..c8bd1be60a 100644
--- a/ext/libxml/libxml.c
+++ b/ext/libxml/libxml.c
@@ -525,6 +525,8 @@ static void php_libxml_ctx_error_level(int level, void *ctx, const char *msg)
} else {
php_error_docref(NULL, level, "%s in Entity, line: %d", msg, parser->input->line);
}
+ } else {
+ php_error_docref(NULL, E_WARNING, "%s", msg);
}
}
diff --git a/ext/libxml/tests/bug61367-read_2.phpt b/ext/libxml/tests/bug61367-read_2.phpt
index ed6576aa75..b935261cb2 100644
--- a/ext/libxml/tests/bug61367-read_2.phpt
+++ b/ext/libxml/tests/bug61367-read_2.phpt
@@ -55,6 +55,6 @@ bool(true)
int(4)
bool(true)
-Warning: DOMDocument::loadXML(): I/O warning : failed to load external entity "file:///%s/test_bug_61367-read/bad" in %s on line %d
+Warning: DOMDocument::loadXML(): %Sfailed to load external entity "file:///%s/test_bug_61367-read/bad" in %s on line %d
Warning: Attempt to read property "nodeValue" on null in %s on line %d
diff --git a/ext/libxml/tests/libxml_disable_entity_loader_2.phpt b/ext/libxml/tests/libxml_disable_entity_loader_2.phpt
index caa7356ad3..d90f909ac2 100644
--- a/ext/libxml/tests/libxml_disable_entity_loader_2.phpt
+++ b/ext/libxml/tests/libxml_disable_entity_loader_2.phpt
@@ -38,6 +38,6 @@ bool(true)
Deprecated: Function libxml_disable_entity_loader() is deprecated in %s on line %d
bool(false)
-Warning: DOMDocument::loadXML(): I/O warning : failed to load external entity "%s" in %s on line %d
+Warning: DOMDocument::loadXML(): %Sfailed to load external entity "%s" in %s on line %d
bool(true)
Done
diff --git a/ext/libxml/tests/libxml_set_external_entity_loader_variation2.phpt b/ext/libxml/tests/libxml_set_external_entity_loader_variation2.phpt
index 87894bcb91..ddaf9bfa50 100644
--- a/ext/libxml/tests/libxml_set_external_entity_loader_variation2.phpt
+++ b/ext/libxml/tests/libxml_set_external_entity_loader_variation2.phpt
@@ -39,6 +39,8 @@ echo "Done.\n";
string(10) "-//FOO/BAR"
string(%d) "%sfoobar.dtd"
+Warning: DOMDocument::validate(): Failed to load external entity "-//FOO/BAR" in %s on line %d
+
Warning: DOMDocument::validate(): Could not load the external subset "foobar.dtd" in %s on line %d
bool(false)
bool(true)
diff --git a/ext/xml/tests/bug26614_libxml.phpt b/ext/xml/tests/bug26614_libxml_gte2_11.phpt
similarity index 86%
copy from ext/xml/tests/bug26614_libxml.phpt
copy to ext/xml/tests/bug26614_libxml_gte2_11.phpt
index b6c0b87581..9a81b67686 100644
--- a/ext/xml/tests/bug26614_libxml.phpt
+++ b/ext/xml/tests/bug26614_libxml_gte2_11.phpt
@@ -1,9 +1,11 @@
--TEST--
Bug #26614 (CDATA sections skipped on line count)
+--EXTENSIONS--
+xml
--SKIPIF--
<?php
-require_once("skipif.inc");
if (!defined("LIBXML_VERSION")) die('skip libxml2 test');
+if (LIBXML_VERSION < 21100) die('skip libxml2 test variant for version >= 2.11');
?>
--FILE--
<?php
@@ -83,11 +85,11 @@ foreach ($xmls as $desc => $xml) {
?>
--EXPECTF--
CDATA
-<DATA> at line 2, col %d (byte 9)
-</DATA> at line 9, col %d (byte 55)
+<DATA> at line 2, col %d (byte 50)
+</DATA> at line 9, col %d (byte 96)
Comment
-<DATA> at line 2, col %d (byte 9)
-</DATA> at line 9, col %d (byte 55)
+<DATA> at line 2, col %d (byte 50)
+</DATA> at line 9, col %d (byte 96)
Text
-<DATA> at line 2, col %d (byte 9)
-</DATA> at line 9, col %d (byte 55)
+<DATA> at line 2, col %d (byte 50)
+</DATA> at line 9, col %d (byte 96)
diff --git a/ext/xml/tests/bug26614_libxml.phpt b/ext/xml/tests/bug26614_libxml_pre2_11.phpt
similarity index 96%
rename from ext/xml/tests/bug26614_libxml.phpt
rename to ext/xml/tests/bug26614_libxml_pre2_11.phpt
index b6c0b87581..90283850d2 100644
--- a/ext/xml/tests/bug26614_libxml.phpt
+++ b/ext/xml/tests/bug26614_libxml_pre2_11.phpt
@@ -4,6 +4,7 @@ Bug #26614 (CDATA sections skipped on line count)
<?php
require_once("skipif.inc");
if (!defined("LIBXML_VERSION")) die('skip libxml2 test');
+if (LIBXML_VERSION >= 21100) die('skip libxml2 test variant for version < 2.11');
?>
--FILE--
<?php