From f0d24c77e3d1e18f1e588d5746b523dba77bd121 Mon Sep 17 00:00:00 2001 From: Andy Postnikov Date: Fri, 28 Apr 2023 20:26:11 +0200 Subject: [PATCH] community/php81: upgrade to 8.1.19 --- community/php81/APKBUILD | 10 +- community/php81/disabled-tests.list | 7 - community/php81/fix-libxml-2-11.patch | 324 ++++++++++++++++++++++++++ 3 files changed, 330 insertions(+), 11 deletions(-) create mode 100644 community/php81/fix-libxml-2-11.patch diff --git a/community/php81/APKBUILD b/community/php81/APKBUILD index 398944ecc55..84778beaea0 100644 --- a/community/php81/APKBUILD +++ b/community/php81/APKBUILD @@ -26,8 +26,8 @@ pkgname=php81 _pkgreal=php -pkgver=8.1.18 -pkgrel=2 +pkgver=8.1.19 +pkgrel=0 _apiver=20210902 _suffix=${pkgname#php} # Is this package the default (latest) PHP version? @@ -105,6 +105,7 @@ source="$_pkgreal-$pkgver.tar.xz::https://php.net/distributions/$_pkgreal-$pkgve sharedir.patch $pkgname-fpm-version-suffix.patch fix-tests-devserver.patch + fix-libxml-2-11.patch " builddir="$srcdir/$_pkgreal-$pkgver" @@ -615,14 +616,15 @@ _extensions_by_load_order() { } sha512sums=" -e30dba23ab8711a04c21ad040d69807f479760a20f363fe3f91a297e9e6463d9558299b15231e00e2b1c95d03309e03bde8cbbe4043fce3e1b965236ece1d0f3 php-8.1.18.tar.xz +a54381277bf40bc184494696ce4779e7b882a7573c9f38ca70306cfba7db356bed5bc1cbf0426bb2acf5c48508acd79c4c760b3e7201590797194bbdf163f4c4 php-8.1.19.tar.xz 7dc9f55b12998355a6a6b5cf277285058e66928215f8d0109448d06fb696a74c674f83d18a81bf03f4f0bee06e77979e9a4ee5c81c7fdebff91447f8e697cc69 php81-fpm.initd 98bb27864f1ece80fef18cb286885c8c18de8f9d1076507b6a24df07e33aa400623b90401375e7ebe55d9ff802069d281642ec7d3a58ef8727121aabe7643241 php81-fpm.logrotate 2e3b22b4adbc81c6120757095c89e56642f3e8bf7724af2926f2667759ef082cdcff416334aad87f704a61fcb5b2c11830f17759ac771a3dd4e47d9bc5c7cf72 php81-module.conf -e7c4d25749bfcd8cb1253d278e3383cb1450d58b5389ec51f4f0359deb090d804363bdc34cb83cd969ea0a86317392907a965bb6bd99aad5bb7648e1c38b073f disabled-tests.list +84e28c6907b2230a96a885358d7cd05319ea93ef9d7391be69355d79f20cd2d104640903139784634e817082ed98f6c6f6fe3eaeee12ef830f2688359b4d276c disabled-tests.list ec206639d076ddac6c2d1db697a5428ed3be979157db39417af7fbe6ab837e8dc00315ae0e55aea4f92f45ca5827c88cc4933099fad9c962f029ca81bef779d7 install-pear.patch e88ad17895742b74019912ad45c90af74817d75d7e1f71bd3d4a180b5f710a25d3c73c7410394f415eee0f428a8c5a0ea3702009ef9d2bffdebdd5da748f8b9b includedir.patch 8db38c523a8e0ed64298661d328372ea33ba0a56d23c023299ad94ee43a6db8c49393efcb679e74bbb936383dcacebdfb440bbacdf74068d78d071dd3f795101 sharedir.patch f43ab399c3b4a2b9a3a329acd32d9cbc690cad697dd0a0e87f3d654028b88af7dd1cd80cbf970c6fe95a44d9b24646640bb4cc9eba15f36afc171504f1060066 php81-fpm-version-suffix.patch 1b64a7cef9e81387f955cb60ffa4e3d2277b4f6072e9328d779c0d447c202c8ee9dff0d8d8c34abc82c150311f51c4e9316a3b72a383ca6c9a6e683bc5b349a0 fix-tests-devserver.patch +8a6348376ac3adcb49b8e5c020b1d893a06351618dc71b9a4ea1d8dc36a1aa4c98e4dd9781f5266f1bba89c82e728de83bc82ecc7528e64370f3fc3422e164b9 fix-libxml-2-11.patch " diff --git a/community/php81/disabled-tests.list b/community/php81/disabled-tests.list index a3ee1ecb045..e931fd6da63 100644 --- a/community/php81/disabled-tests.list +++ b/community/php81/disabled-tests.list @@ -206,10 +206,3 @@ ext/openssl/tests/openssl_error_string_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 diff --git a/community/php81/fix-libxml-2-11.patch b/community/php81/fix-libxml-2-11.patch new file mode 100644 index 00000000000..06b6750c20a --- /dev/null +++ b/community/php81/fix-libxml-2-11.patch @@ -0,0 +1,324 @@ +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 000000000000..ff5ceb3fbed5 +--- /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-- ++= 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 ++--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 90% +rename from ext/dom/tests/DOMDocument_loadXML_error2.phpt +rename to ext/dom/tests/DOMDocument_loadXML_error2_pre2_11.phpt +index a24d5215da48..c826386f7a4e 100644 +--- a/ext/dom/tests/DOMDocument_loadXML_error2.phpt ++++ b/ext/dom/tests/DOMDocument_loadXML_error2_pre2_11.phpt +@@ -1,5 +1,9 @@ + --TEST-- + Test DOMDocument::loadXML() detects not-well formed XML ++--SKIPIF-- ++= 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: +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 000000000000..32b6bf161142 +--- /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-- ++= 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 ++--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 90% +rename from ext/dom/tests/DOMDocument_load_error2.phpt +rename to ext/dom/tests/DOMDocument_load_error2_pre2_11.phpt +index cd13b3f901b2..695740be9ca9 100644 +--- a/ext/dom/tests/DOMDocument_load_error2.phpt ++++ b/ext/dom/tests/DOMDocument_load_error2_pre2_11.phpt +@@ -1,5 +1,9 @@ + --TEST-- + Test DOMDocument::load() detects not-well formed XML ++--SKIPIF-- ++= 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: +diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c +index b4099bb7b822..3959b362a0e4 100644 +--- a/ext/libxml/libxml.c ++++ b/ext/libxml/libxml.c +@@ -527,6 +527,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 8adad1ce429f..38f12949bcbb 100644 +--- a/ext/libxml/tests/bug61367-read_2.phpt ++++ b/ext/libxml/tests/bug61367-read_2.phpt +@@ -56,6 +56,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 ad253171625f..182fe13cfda9 100644 +--- a/ext/libxml/tests/libxml_disable_entity_loader_2.phpt ++++ b/ext/libxml/tests/libxml_disable_entity_loader_2.phpt +@@ -39,6 +39,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 9ebf2c0e9d32..5657b727bacd 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_gte2_11.phpt b/ext/xml/tests/bug26614_libxml_gte2_11.phpt +new file mode 100644 +index 000000000000..9a81b67686d1 +--- /dev/null ++++ b/ext/xml/tests/bug26614_libxml_gte2_11.phpt +@@ -0,0 +1,95 @@ ++--TEST-- ++Bug #26614 (CDATA sections skipped on line count) ++--EXTENSIONS-- ++xml ++--SKIPIF-- ++= 2.11'); ++?> ++--FILE-- ++ ++ ++ ++'; ++ ++// Case 2: replace some characters so that we get comments instead ++$xmls["Comment"] =' ++ ++ ++'; ++ ++// Case 3: replace even more characters so that only textual data is left ++$xmls["Text"] =' ++ ++-!-- ATA[ ++multi ++line ++CDATA ++block ++--- ++'; ++ ++function startElement($parser, $name, $attrs) { ++ printf("<$name> at line %d, col %d (byte %d)\n", ++ xml_get_current_line_number($parser), ++ xml_get_current_column_number($parser), ++ xml_get_current_byte_index($parser)); ++} ++ ++function endElement($parser, $name) { ++ printf(" at line %d, col %d (byte %d)\n", ++ xml_get_current_line_number($parser), ++ xml_get_current_column_number($parser), ++ xml_get_current_byte_index($parser)); ++} ++ ++function characterData($parser, $data) { ++ // dummy ++} ++ ++foreach ($xmls as $desc => $xml) { ++ echo "$desc\n"; ++ $xml_parser = xml_parser_create(); ++ xml_set_element_handler($xml_parser, "startElement", "endElement"); ++ xml_set_character_data_handler($xml_parser, "characterData"); ++ if (!xml_parse($xml_parser, $xml, true)) ++ echo "Error: ".xml_error_string(xml_get_error_code($xml_parser))."\n"; ++ xml_parser_free($xml_parser); ++} ++?> ++--EXPECTF-- ++CDATA ++ at line 2, col %d (byte 50) ++ at line 9, col %d (byte 96) ++Comment ++ at line 2, col %d (byte 50) ++ at line 9, col %d (byte 96) ++Text ++ at line 2, col %d (byte 50) ++ 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 6acf2c44b2a6..c581a08e9b8f 100644 +--- a/ext/xml/tests/bug26614_libxml.phpt ++++ b/ext/xml/tests/bug26614_libxml_pre2_11.phpt +@@ -5,6 +5,7 @@ xml + --SKIPIF-- + = 21100) die('skip libxml2 test variant for version < 2.11'); + ?> + --FILE-- +