diff options
author | Remi Collet <remi@remirepo.net> | 2023-12-07 10:05:23 +0100 |
---|---|---|
committer | Remi Collet <remi@php.net> | 2023-12-07 10:05:23 +0100 |
commit | 609aeee3a33f595986316f911829a58733cc9bda (patch) | |
tree | a3fe78957d2bb7247f93a6cae1c484c1ce86f2a3 | |
parent | 7aac0b618907230bc78d5262f5b2bb4dd97286ae (diff) |
refresh
-rw-r--r-- | php-7.2.0-includedir.patch | 4 | ||||
-rw-r--r-- | php-7.2.0-libdb.patch | 4 | ||||
-rw-r--r-- | php-7.2.0-oci8conf.patch | 26 | ||||
-rw-r--r-- | php-7.4.33-libxml212.patch | 661 | ||||
-rw-r--r-- | php-7.4.8-phpinfo.patch | 6 | ||||
-rw-r--r-- | php-bug81746.patch | 2 | ||||
-rw-r--r-- | php-cve-2023-3824.patch | 20 |
7 files changed, 681 insertions, 42 deletions
diff --git a/php-7.2.0-includedir.patch b/php-7.2.0-includedir.patch index 6d9a871..2202026 100644 --- a/php-7.2.0-includedir.patch +++ b/php-7.2.0-includedir.patch @@ -1,11 +1,11 @@ --- php-7.2.0/configure.ac.includedir +++ php-7.2.0/configure.ac -@@ -1230,7 +1230,7 @@ +@@ -1283,7 +1283,7 @@ EXPANDED_DATADIR=$datadir EXPANDED_PHP_CONFIG_FILE_PATH=`eval echo "$PHP_CONFIG_FILE_PATH"` EXPANDED_PHP_CONFIG_FILE_SCAN_DIR=`eval echo "$PHP_CONFIG_FILE_SCAN_DIR"` -INCLUDE_PATH=.:$EXPANDED_PEAR_INSTALLDIR -+INCLUDE_PATH=.:$EXPANDED_PEAR_INSTALLDIR:${EXPANDED_DATADIR}/php ++INCLUDE_PATH=.:$EXPANDED_PEAR_INSTALLDIR:${EXPANDED_DATADIR}/php:/usr/share/pear:/usr/share/php exec_prefix=$old_exec_prefix libdir=$old_libdir diff --git a/php-7.2.0-libdb.patch b/php-7.2.0-libdb.patch index ca36d1a..11acd17 100644 --- a/php-7.2.0-libdb.patch +++ b/php-7.2.0-libdb.patch @@ -1,7 +1,7 @@ diff -up php-7.2.0alpha0/ext/dba/config.m4.libdb php-7.2.0alpha0/ext/dba/config.m4 --- php-7.2.0alpha0/ext/dba/config.m4.libdb 2017-05-29 08:56:06.000000000 +0200 +++ php-7.2.0alpha0/ext/dba/config.m4 2017-05-29 09:13:52.014823282 +0200 -@@ -346,61 +346,13 @@ if test "$PHP_DB4" != "no"; then +@@ -375,61 +375,13 @@ if test "$PHP_DB4" != "no"; then dbdp4="/usr/local/BerkeleyDB.4." dbdp5="/usr/local/BerkeleyDB.5." for i in $PHP_DB4 ${dbdp5}1 ${dbdp5}0 ${dbdp4}8 ${dbdp4}7 ${dbdp4}6 ${dbdp4}5 ${dbdp4}4 ${dbdp4}3 ${dbdp4}2 ${dbdp4}1 ${dbdp}0 /usr/local /usr; do @@ -68,7 +68,7 @@ diff -up php-7.2.0alpha0/ext/dba/config.m4.libdb php-7.2.0alpha0/ext/dba/config. diff -up php-7.2.0alpha0/ext/dba/dba.c.libdb php-7.2.0alpha0/ext/dba/dba.c --- php-7.2.0alpha0/ext/dba/dba.c.libdb 2017-05-29 09:16:15.736628202 +0200 +++ php-7.2.0alpha0/ext/dba/dba.c 2017-05-29 09:16:20.494654746 +0200 -@@ -53,6 +53,10 @@ +@@ -51,6 +51,10 @@ #include "php_tcadb.h" #include "php_lmdb.h" diff --git a/php-7.2.0-oci8conf.patch b/php-7.2.0-oci8conf.patch index 0ad16a1..3bf1c2e 100644 --- a/php-7.2.0-oci8conf.patch +++ b/php-7.2.0-oci8conf.patch @@ -1,7 +1,7 @@ diff -up ./ext/ldap/php_ldap.h.remi-oci8 ./ext/ldap/php_ldap.h --- ./ext/ldap/php_ldap.h.remi-oci8 2017-06-20 15:45:35.000000000 +0200 +++ ./ext/ldap/php_ldap.h 2017-06-20 16:55:01.640203868 +0200 -@@ -27,7 +27,7 @@ +@@ -25,7 +25,7 @@ #include <lber.h> #endif @@ -10,26 +10,4 @@ diff -up ./ext/ldap/php_ldap.h.remi-oci8 ./ext/ldap/php_ldap.h extern zend_module_entry ldap_module_entry; #define ldap_module_ptr &ldap_module_entry -diff -up ./ext/oci8/config.m4.remi-oci8 ./ext/oci8/config.m4 ---- ./ext/oci8/config.m4.remi-oci8 2017-06-20 15:45:39.000000000 +0200 -+++ ./ext/oci8/config.m4 2017-06-20 16:55:01.640203868 +0200 -@@ -372,6 +372,7 @@ if test "$PHP_OCI8" != "no"; then - - dnl Header directory for Instant Client SDK RPM install - OCISDKRPMINC=`echo "$PHP_OCI8_INSTANT_CLIENT" | $PHP_OCI8_SED -e 's!^/usr/lib/oracle/\(.*\)/client\('${PHP_OCI8_IC_LIBDIR_SUFFIX}'\)*/lib[/]*$!/usr/include/oracle/\1/client\2!'` -+ OCISDKRPMINC=`echo "$PHP_OCI8_INSTANT_CLIENT" | $PHP_OCI8_SED -e 's!^/usr/\(lib64\|lib\)/oracle/\(.*\)/\(client64\|client\)/lib[/]*$!/usr/include/oracle/\2/\3!'` - - dnl Header directory for Instant Client SDK zip file install - OCISDKZIPINC=$PHP_OCI8_INSTANT_CLIENT/sdk/include -diff -up ./ext/pdo_oci/config.m4.remi-oci8 ./ext/pdo_oci/config.m4 ---- ./ext/pdo_oci/config.m4.remi-oci8 2017-06-20 16:55:01.640203868 +0200 -+++ ./ext/pdo_oci/config.m4 2017-06-20 17:16:03.053538358 +0200 -@@ -93,7 +93,7 @@ if test "$PHP_PDO_OCI" != "no"; then - - AC_MSG_CHECKING([for oci.h]) - dnl Header directory for Instant Client SDK RPM install -- OCISDKRPMINC=`echo "$PDO_OCI_LIB_DIR" | $PHP_PDO_OCI_SED -e 's!^\(.*\)/lib/oracle/\(.*\)/\('${PDO_OCI_CLIENT_DIR}'\)/lib[/]*$!\1/include/oracle/\2/\3!'` -+ OCISDKRPMINC=`echo "$PDO_OCI_LIB_DIR" | $PHP_PDO_OCI_SED -e 's!^\(.*\)/\(lib64\|lib\)/oracle/\(.*\)/\('${PDO_OCI_CLIENT_DIR}'\)/lib[/]*$!\1/include/oracle/\3/\4!'` - - dnl Header directory for manual installation - OCISDKMANINC=`echo "$PDO_OCI_LIB_DIR" | $PHP_PDO_OCI_SED -e 's!^\(.*\)/lib[/]*$!\1/include!'` + diff --git a/php-7.4.33-libxml212.patch b/php-7.4.33-libxml212.patch new file mode 100644 index 0000000..2de8abb --- /dev/null +++ b/php-7.4.33-libxml212.patch @@ -0,0 +1,661 @@ +From 1fa2356f4f580d2df4068809a4aba6d5356a22e6 Mon Sep 17 00:00:00 2001 +From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> +Date: Fri, 17 Nov 2023 19:45:40 +0100 +Subject: [PATCH 1/4] Fix GH-12702: libxml2 2.12.0 issue building from src + +Fixes GH-12702. + +Co-authored-by: nono303 <github@nono303.net> +--- + ext/dom/document.c | 1 + + ext/libxml/php_libxml.h | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/ext/dom/document.c b/ext/dom/document.c +index b478e1a1aa..707a1fbb20 100644 +--- a/ext/dom/document.c ++++ b/ext/dom/document.c +@@ -25,6 +25,7 @@ + #if HAVE_LIBXML && HAVE_DOM + #include "php_dom.h" + #include <libxml/SAX.h> ++#include <libxml/xmlsave.h> + #ifdef LIBXML_SCHEMAS_ENABLED + #include <libxml/relaxng.h> + #include <libxml/xmlschemas.h> +diff --git a/ext/libxml/php_libxml.h b/ext/libxml/php_libxml.h +index cf936e95de..9bbcbf6783 100644 +--- a/ext/libxml/php_libxml.h ++++ b/ext/libxml/php_libxml.h +@@ -37,6 +37,7 @@ extern zend_module_entry libxml_module_entry; + + #include "zend_smart_str.h" + #include <libxml/tree.h> ++#include <libxml/parser.h> + + #define LIBXML_SAVE_NOEMPTYTAG 1<<2 + +-- +2.43.0 + +From c2a134e08fe4ac4a2ed753548a18fc27da8ae2e1 Mon Sep 17 00:00:00 2001 +From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> +Date: Fri, 1 Dec 2023 18:03:35 +0100 +Subject: [PATCH 2/4] Fix libxml2 2.12 build due to API breaks + +See https://github.com/php/php-src/actions/runs/7062192818/job/19225478601 +--- + ext/libxml/libxml.c | 14 ++++++++++---- + ext/soap/php_sdl.c | 2 +- + 2 files changed, 11 insertions(+), 5 deletions(-) + +diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c +index d343135b98..b54ab40953 100644 +--- a/ext/libxml/libxml.c ++++ b/ext/libxml/libxml.c +@@ -530,7 +530,11 @@ static int _php_libxml_free_error(xmlErrorPtr error) + return 1; + } + +-static void _php_list_set_error_structure(xmlErrorPtr error, const char *msg) ++#if LIBXML_VERSION >= 21200 ++static void _php_list_set_error_structure(const xmlError *error, const char *msg) ++#else ++static void _php_list_set_error_structure(xmlError *error, const char *msg) ++#endif + { + xmlError error_copy; + int ret; +@@ -782,7 +786,11 @@ PHP_LIBXML_API void php_libxml_ctx_warning(void *ctx, const char *msg, ...) + va_end(args); + } + ++#if LIBXML_VERSION >= 21200 ++PHP_LIBXML_API void php_libxml_structured_error_handler(void *userData, const xmlError *error) ++#else + PHP_LIBXML_API void php_libxml_structured_error_handler(void *userData, xmlErrorPtr error) ++#endif + { + _php_list_set_error_structure(error, NULL); + +@@ -1061,9 +1069,7 @@ static PHP_FUNCTION(libxml_use_internal_errors) + Retrieve last error from libxml */ + static PHP_FUNCTION(libxml_get_last_error) + { +- xmlErrorPtr error; +- +- error = xmlGetLastError(); ++ const xmlError *error = xmlGetLastError(); + + if (error) { + object_init_ex(return_value, libxmlerror_class_entry); +diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c +index 26a23f57db..3df532a2d6 100644 +--- a/ext/soap/php_sdl.c ++++ b/ext/soap/php_sdl.c +@@ -333,7 +333,7 @@ static void load_wsdl_ex(zval *this_ptr, char *struri, sdlCtx *ctx, int include) + sdl_restore_uri_credentials(ctx); + + if (!wsdl) { +- xmlErrorPtr xmlErrorPtr = xmlGetLastError(); ++ const xmlError *xmlErrorPtr = xmlGetLastError(); + + if (xmlErrorPtr) { + soap_error2(E_ERROR, "Parsing WSDL: Couldn't load from '%s' : %s", struri, xmlErrorPtr->message); +-- +2.43.0 + +From f9da49aa0a5b033c4b1e8072b9c0915d7672f34e 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 3/4] 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 + +Closes GH-11162. +--- + .../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 90% +rename from ext/dom/tests/DOMDocument_loadXML_error2.phpt +rename to ext/dom/tests/DOMDocument_loadXML_error2_pre2_11.phpt +index 6d56a317ed..0e36d20905 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-- ++<?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: +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 90% +rename from ext/dom/tests/DOMDocument_load_error2.phpt +rename to ext/dom/tests/DOMDocument_load_error2_pre2_11.phpt +index f450cf1654..b97fff9d2f 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-- ++<?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: +diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c +index b54ab40953..7917f636a9 100644 +--- a/ext/libxml/libxml.c ++++ b/ext/libxml/libxml.c +@@ -578,6 +578,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 8cc0b50144..12743adab1 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 + + Notice: Trying to get property 'nodeValue' of non-object 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 845bd4bbe3..55d8e61ee0 100644 +--- a/ext/libxml/tests/libxml_disable_entity_loader_2.phpt ++++ b/ext/libxml/tests/libxml_disable_entity_loader_2.phpt +@@ -36,6 +36,6 @@ echo "Done\n"; + bool(true) + 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 e51869cf47..0664de1ea6 100644 +--- a/ext/libxml/tests/libxml_set_external_entity_loader_variation2.phpt ++++ b/ext/libxml/tests/libxml_set_external_entity_loader_variation2.phpt +@@ -38,6 +38,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 0000000000..9a81b67686 +--- /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-- ++<?php ++if (!defined("LIBXML_VERSION")) die('skip libxml2 test'); ++if (LIBXML_VERSION < 21100) die('skip libxml2 test variant for version >= 2.11'); ++?> ++--FILE-- ++<?php ++/* ++this test works fine with Expat but fails with libxml ++which we now use as default ++ ++further investigation has shown that not only line count ++is skipped on CDATA sections but that libxml does also ++show different column numbers and byte positions depending ++on context and in opposition to what one would expect to ++see and what good old Expat reported just fine ... ++*/ ++ ++$xmls = array(); ++ ++// Case 1: CDATA Sections ++$xmls["CDATA"] ='<?xml version="1.0" encoding="iso-8859-1" ?> ++<data> ++<![CDATA[ ++multi ++line ++CDATA ++block ++]]> ++</data>'; ++ ++// Case 2: replace some characters so that we get comments instead ++$xmls["Comment"] ='<?xml version="1.0" encoding="iso-8859-1" ?> ++<data> ++<!-- ATA[ ++multi ++line ++CDATA ++block ++--> ++</data>'; ++ ++// Case 3: replace even more characters so that only textual data is left ++$xmls["Text"] ='<?xml version="1.0" encoding="iso-8859-1" ?> ++<data> ++-!-- ATA[ ++multi ++line ++CDATA ++block ++--- ++</data>'; ++ ++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("</$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 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 ++<DATA> at line 2, col %d (byte 50) ++</DATA> at line 9, col %d (byte 96) ++Comment ++<DATA> at line 2, col %d (byte 50) ++</DATA> at line 9, col %d (byte 96) ++Text ++<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 3ddd35ed0e..afacaa1c59 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 +-- +2.43.0 + +From b2ac6c4fe4213258e7e9489ef50fe3afb2fdf4be Mon Sep 17 00:00:00 2001 +From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> +Date: Wed, 29 Nov 2023 20:49:29 +0100 +Subject: [PATCH 4/4] Test fixes for libxml2 2.12.0 + +--- + ext/dom/tests/DOMDocument_loadXML_error1.phpt | 4 +++ + .../DOMDocument_loadXML_error1_gte2_12.phpt | 26 ++++++++++++++++ + .../DOMDocument_loadXML_error2_gte2_11.phpt | 2 +- + .../DOMDocument_loadXML_error2_gte2_12.phpt | 30 +++++++++++++++++++ + ext/dom/tests/DOMDocument_load_error1.phpt | 4 +++ + .../DOMDocument_load_error1_gte2_12.phpt | 26 ++++++++++++++++ + .../DOMDocument_load_error2_gte2_11.phpt | 2 +- + .../DOMDocument_load_error2_gte2_12.phpt | 30 +++++++++++++++++++ + ext/xml/tests/bug81351.phpt | 4 +-- + 9 files changed, 124 insertions(+), 4 deletions(-) + create mode 100644 ext/dom/tests/DOMDocument_loadXML_error1_gte2_12.phpt + create mode 100644 ext/dom/tests/DOMDocument_loadXML_error2_gte2_12.phpt + create mode 100644 ext/dom/tests/DOMDocument_load_error1_gte2_12.phpt + create mode 100644 ext/dom/tests/DOMDocument_load_error2_gte2_12.phpt + +diff --git a/ext/dom/tests/DOMDocument_loadXML_error1.phpt b/ext/dom/tests/DOMDocument_loadXML_error1.phpt +index 4d3b81db79..0549d67630 100644 +--- a/ext/dom/tests/DOMDocument_loadXML_error1.phpt ++++ b/ext/dom/tests/DOMDocument_loadXML_error1.phpt +@@ -1,5 +1,9 @@ + --TEST-- + Test DOMDocument::loadXML() detects not-well formed XML ++--SKIPIF-- ++<?php ++if (LIBXML_VERSION >= 21200) die('skip libxml2 test variant for version < 2.12'); ++?> + --DESCRIPTION-- + This test verifies the method detects an opening and ending tag mismatch + Environment variables used in the test: +diff --git a/ext/dom/tests/DOMDocument_loadXML_error1_gte2_12.phpt b/ext/dom/tests/DOMDocument_loadXML_error1_gte2_12.phpt +new file mode 100644 +index 0000000000..e1ded0ffad +--- /dev/null ++++ b/ext/dom/tests/DOMDocument_loadXML_error1_gte2_12.phpt +@@ -0,0 +1,26 @@ ++--TEST-- ++Test DOMDocument::loadXML() detects not-well formed XML ++--SKIPIF-- ++<?php ++if (LIBXML_VERSION < 21200) die('skip libxml2 test variant for version >= 2.12'); ++?> ++--DESCRIPTION-- ++This test verifies the method detects an opening and ending tag mismatch ++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> ++--EXTENSIONS-- ++dom ++--ENV-- ++XML_FILE=/not_well_formed.xml ++LOAD_OPTIONS=0 ++EXPECTED_RESULT=0 ++--FILE_EXTERNAL-- ++domdocumentloadxml_test_method.inc ++--EXPECTF-- ++Warning: DOMDocument::load%r(XML){0,1}%r(): Opening and ending tag mismatch: title line 5 and book %s ++ ++Warning: DOMDocument::load%r(XML){0,1}%r(): %rexpected '>'|Opening and ending tag mismatch: book line (4|5) and books%r %s +diff --git a/ext/dom/tests/DOMDocument_loadXML_error2_gte2_11.phpt b/ext/dom/tests/DOMDocument_loadXML_error2_gte2_11.phpt +index ff5ceb3fbe..f52d334813 100644 +--- a/ext/dom/tests/DOMDocument_loadXML_error2_gte2_11.phpt ++++ b/ext/dom/tests/DOMDocument_loadXML_error2_gte2_11.phpt +@@ -2,7 +2,7 @@ + Test DOMDocument::loadXML() detects not-well formed XML + --SKIPIF-- + <?php +-if (LIBXML_VERSION < 21100) die('skip libxml2 test variant for version >= 2.11'); ++if (LIBXML_VERSION < 21100 || LIBXML_VERSION >= 21200) die('skip libxml2 test variant for version >= 2.11 && <= 2.12'); + ?> + --DESCRIPTION-- + This test verifies the method detects attributes values not closed between " or ' +diff --git a/ext/dom/tests/DOMDocument_loadXML_error2_gte2_12.phpt b/ext/dom/tests/DOMDocument_loadXML_error2_gte2_12.phpt +new file mode 100644 +index 0000000000..6a3ff5841f +--- /dev/null ++++ b/ext/dom/tests/DOMDocument_loadXML_error2_gte2_12.phpt +@@ -0,0 +1,30 @@ ++--TEST-- ++Test DOMDocument::loadXML() detects not-well formed XML ++--SKIPIF-- ++<?php ++if (LIBXML_VERSION < 21200) die('skip libxml2 test variant for version >= 2.12'); ++?> ++--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> ++--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 +diff --git a/ext/dom/tests/DOMDocument_load_error1.phpt b/ext/dom/tests/DOMDocument_load_error1.phpt +index 8ac181d769..4416f5f6fe 100644 +--- a/ext/dom/tests/DOMDocument_load_error1.phpt ++++ b/ext/dom/tests/DOMDocument_load_error1.phpt +@@ -1,5 +1,9 @@ + --TEST-- + Test DOMDocument::load() detects not-well formed XML ++--SKIPIF-- ++<?php ++if (LIBXML_VERSION >= 21200) die('skip libxml2 test variant for version < 2.12'); ++?> + --DESCRIPTION-- + This test verifies the method detects an opening and ending tag mismatch + Environment variables used in the test: +diff --git a/ext/dom/tests/DOMDocument_load_error1_gte2_12.phpt b/ext/dom/tests/DOMDocument_load_error1_gte2_12.phpt +new file mode 100644 +index 0000000000..183c8406fd +--- /dev/null ++++ b/ext/dom/tests/DOMDocument_load_error1_gte2_12.phpt +@@ -0,0 +1,26 @@ ++--TEST-- ++Test DOMDocument::load() detects not-well formed XML ++--SKIPIF-- ++<?php ++if (LIBXML_VERSION < 21200) die('skip libxml2 test variant for version >= 2.12'); ++?> ++--DESCRIPTION-- ++This test verifies the method detects an opening and ending tag mismatch ++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> ++--EXTENSIONS-- ++dom ++--ENV-- ++XML_FILE=/not_well_formed.xml ++LOAD_OPTIONS=0 ++EXPECTED_RESULT=0 ++--FILE_EXTERNAL-- ++domdocumentload_test_method.inc ++--EXPECTF-- ++Warning: DOMDocument::load%r(XML){0,1}%r(): Opening and ending tag mismatch: title line 5 and book %s ++ ++Warning: DOMDocument::load%r(XML){0,1}%r(): %rexpected '>'|Opening and ending tag mismatch: book line (4|5) and books%r %s +diff --git a/ext/dom/tests/DOMDocument_load_error2_gte2_11.phpt b/ext/dom/tests/DOMDocument_load_error2_gte2_11.phpt +index 32b6bf1611..4d9f992b3b 100644 +--- a/ext/dom/tests/DOMDocument_load_error2_gte2_11.phpt ++++ b/ext/dom/tests/DOMDocument_load_error2_gte2_11.phpt +@@ -2,7 +2,7 @@ + Test DOMDocument::load() detects not-well formed + --SKIPIF-- + <?php +-if (LIBXML_VERSION < 21100) die('skip libxml2 test variant for version >= 2.11'); ++if (LIBXML_VERSION < 21100 || LIBXML_VERSION >= 21200) die('skip libxml2 test variant for version >= 2.11 && <= 2.12'); + ?> + --DESCRIPTION-- + This test verifies the method detects attributes values not closed between " or ' +diff --git a/ext/dom/tests/DOMDocument_load_error2_gte2_12.phpt b/ext/dom/tests/DOMDocument_load_error2_gte2_12.phpt +new file mode 100644 +index 0000000000..4fadf41736 +--- /dev/null ++++ b/ext/dom/tests/DOMDocument_load_error2_gte2_12.phpt +@@ -0,0 +1,30 @@ ++--TEST-- ++Test DOMDocument::load() detects not-well formed ++--SKIPIF-- ++<?php ++if (LIBXML_VERSION < 21200) die('skip libxml2 test variant for version >= 2.12'); ++?> ++--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> ++--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 +diff --git a/ext/xml/tests/bug81351.phpt b/ext/xml/tests/bug81351.phpt +index 19e4ca590b..dc934001be 100644 +--- a/ext/xml/tests/bug81351.phpt ++++ b/ext/xml/tests/bug81351.phpt +@@ -23,6 +23,6 @@ $code = xml_get_error_code($parser); + $error = xml_error_string($code); + echo "xml_parse returned $success, xml_get_error_code = $code, xml_error_string = $error\r\n"; + ?> +---EXPECT-- ++--EXPECTF-- + xml_parse returned 1, xml_get_error_code = 0, xml_error_string = No error +-xml_parse returned 0, xml_get_error_code = 5, xml_error_string = Invalid document end ++%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 +-- +2.43.0 + diff --git a/php-7.4.8-phpinfo.patch b/php-7.4.8-phpinfo.patch index 9b7175e..fa0fff0 100644 --- a/php-7.4.8-phpinfo.patch +++ b/php-7.4.8-phpinfo.patch @@ -6,7 +6,7 @@ The available extensions are not related to this command. diff -up a/ext/standard/info.c.phpinfo v/ext/standard/info.c --- a/ext/standard/info.c.phpinfo 2015-08-18 23:39:24.000000000 +0200 +++ b/ext/standard/info.c 2015-08-22 07:56:18.344761928 +0200 -@@ -809,9 +809,6 @@ PHPAPI void php_print_info(int flag) +@@ -810,9 +810,6 @@ PHPAPI void php_print_info(int flag) #ifdef ARCHITECTURE php_info_print_table_row(2, "Architecture", ARCHITECTURE); #endif @@ -45,7 +45,7 @@ diff --git a/configure.ac b/configure.ac index d9e6329314a3..77f12a55569a 100644 --- a/configure.ac +++ b/configure.ac -@@ -1328,6 +1328,11 @@ PHP_UNAME=${PHP_UNAME:-$UNAME} +@@ -1329,6 +1329,11 @@ PHP_UNAME=${PHP_UNAME:-$UNAME} AC_DEFINE_UNQUOTED(PHP_UNAME,"$PHP_UNAME",[uname -a output]) PHP_OS=`uname | xargs` AC_DEFINE_UNQUOTED(PHP_OS,"$PHP_OS",[uname output]) @@ -61,7 +61,7 @@ diff --git a/ext/standard/info.c b/ext/standard/info.c index 262e95ae2731..f652efd23657 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c -@@ -803,6 +803,12 @@ PHPAPI ZEND_COLD void php_print_info(int flag) +@@ -804,6 +804,12 @@ PHPAPI ZEND_COLD void php_print_info(int flag) php_info_print_table_start(); php_info_print_table_row(2, "System", ZSTR_VAL(php_uname)); php_info_print_table_row(2, "Build Date", __DATE__ " " __TIME__); diff --git a/php-bug81746.patch b/php-bug81746.patch index 7f4c77f..6e2ba19 100644 --- a/php-bug81746.patch +++ b/php-bug81746.patch @@ -22,7 +22,7 @@ diff --git a/ext/dom/document.c b/ext/dom/document.c index b478e1a1aab..e683eb8f701 100644 --- a/ext/dom/document.c +++ b/ext/dom/document.c -@@ -1379,7 +1379,7 @@ static xmlDocPtr dom_document_parser(zval *id, int mode, char *source, size_t so +@@ -1380,7 +1380,7 @@ static xmlDocPtr dom_document_parser(zval *id, int mode, char *source, size_t so int validate, recover, resolve_externals, keep_blanks, substitute_ent; int resolved_path_len; int old_error_reporting = 0; diff --git a/php-cve-2023-3824.patch b/php-cve-2023-3824.patch index 4a58ac4..9b8b9c4 100644 --- a/php-cve-2023-3824.patch +++ b/php-cve-2023-3824.patch @@ -45,7 +45,7 @@ diff --git a/ext/dom/document.c b/ext/dom/document.c index e683eb8f701..989b5b3dd24 100644 --- a/ext/dom/document.c +++ b/ext/dom/document.c -@@ -1458,6 +1458,7 @@ static xmlDocPtr dom_document_parser(zval *id, int mode, char *source, size_t so +@@ -1459,6 +1459,7 @@ static xmlDocPtr dom_document_parser(zval *id, int mode, char *source, size_t so options |= XML_PARSE_NOBLANKS; } @@ -53,7 +53,7 @@ index e683eb8f701..989b5b3dd24 100644 xmlCtxtUseOptions(ctxt, options); ctxt->recovery = recover; -@@ -1758,7 +1759,9 @@ PHP_FUNCTION(dom_document_xinclude) +@@ -1759,7 +1760,9 @@ PHP_FUNCTION(dom_document_xinclude) DOM_GET_OBJ(docp, id, xmlDocPtr, intern); @@ -63,7 +63,7 @@ index e683eb8f701..989b5b3dd24 100644 /* XML_XINCLUDE_START and XML_XINCLUDE_END nodes need to be removed as these are added via xmlXIncludeProcess to mark beginning and ending of xincluded document -@@ -1798,6 +1801,7 @@ PHP_FUNCTION(dom_document_validate) +@@ -1799,6 +1802,7 @@ PHP_FUNCTION(dom_document_validate) DOM_GET_OBJ(docp, id, xmlDocPtr, intern); @@ -71,7 +71,7 @@ index e683eb8f701..989b5b3dd24 100644 cvp = xmlNewValidCtxt(); cvp->userData = NULL; -@@ -1809,6 +1813,7 @@ PHP_FUNCTION(dom_document_validate) +@@ -1810,6 +1814,7 @@ PHP_FUNCTION(dom_document_validate) } else { RETVAL_FALSE; } @@ -79,7 +79,7 @@ index e683eb8f701..989b5b3dd24 100644 xmlFreeValidCtxt(cvp); -@@ -1843,14 +1848,18 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type +@@ -1844,14 +1849,18 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type DOM_GET_OBJ(docp, id, xmlDocPtr, intern); @@ -98,7 +98,7 @@ index e683eb8f701..989b5b3dd24 100644 php_error_docref(NULL, E_WARNING, "Invalid Schema file source"); RETURN_FALSE; } -@@ -1871,6 +1880,7 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type +@@ -1872,6 +1881,7 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type parser); sptr = xmlSchemaParse(parser); xmlSchemaFreeParserCtxt(parser); @@ -106,7 +106,7 @@ index e683eb8f701..989b5b3dd24 100644 if (!sptr) { php_error_docref(NULL, E_WARNING, "Invalid Schema"); RETURN_FALSE; -@@ -1889,11 +1899,13 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type +@@ -1890,11 +1900,13 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type valid_opts |= XML_SCHEMA_VAL_VC_I_CREATE; } @@ -120,7 +120,7 @@ index e683eb8f701..989b5b3dd24 100644 if (is_valid == 0) { RETURN_TRUE; -@@ -1964,12 +1976,14 @@ static void _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int typ +@@ -1965,12 +1977,14 @@ static void _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int typ return; } @@ -135,7 +135,7 @@ index e683eb8f701..989b5b3dd24 100644 if (!sptr) { php_error_docref(NULL, E_WARNING, "Invalid RelaxNG"); RETURN_FALSE; -@@ -2068,6 +2082,7 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */ +@@ -2069,6 +2083,7 @@ static void dom_load_html(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */ ctxt->sax->error = php_libxml_ctx_error; ctxt->sax->warning = php_libxml_ctx_warning; } @@ -203,7 +203,7 @@ diff --git a/ext/libxml/php_libxml.h b/ext/libxml/php_libxml.h index cf936e95de1..92028d5703e 100644 --- a/ext/libxml/php_libxml.h +++ b/ext/libxml/php_libxml.h -@@ -120,6 +120,42 @@ PHP_LIBXML_API void php_libxml_shutdown(void); +@@ -121,6 +121,42 @@ PHP_LIBXML_API void php_libxml_shutdown(void); ZEND_TSRMLS_CACHE_EXTERN() #endif |