diff options
author | Remi Collet <remi@remirepo.net> | 2023-09-25 09:42:52 +0200 |
---|---|---|
committer | Remi Collet <remi@php.net> | 2023-09-25 09:42:52 +0200 |
commit | 9f0ab67bdc8159b416c0c08e9e011795796c5f2a (patch) | |
tree | 515bf93e3b803be27d962103261af2c85ad82929 | |
parent | eb9b1c1e0292f2ccd9139eda63c4856bd0b98157 (diff) |
add internal UTC if tzdata is missing
-rw-r--r-- | php-7.2.0-oci8conf.patch | 24 | ||||
-rw-r--r-- | php-8.3.0-systzdata-v24.patch (renamed from php-8.1.0-systzdata-v23.patch) | 57 | ||||
-rw-r--r-- | php.spec | 15 |
3 files changed, 53 insertions, 43 deletions
diff --git a/php-7.2.0-oci8conf.patch b/php-7.2.0-oci8conf.patch index 0ad16a1..d026575 100644 --- a/php-7.2.0-oci8conf.patch +++ b/php-7.2.0-oci8conf.patch @@ -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-8.1.0-systzdata-v23.patch b/php-8.3.0-systzdata-v24.patch index 3157660..69d5856 100644 --- a/php-8.1.0-systzdata-v23.patch +++ b/php-8.3.0-systzdata-v24.patch @@ -5,6 +5,7 @@ Add support for use of the system timezone database, rather than embedding a copy. Discussed upstream but was not desired. History: +f24: add internal UTC if tzdata is missing r23: fix possible buffer overflow r22: retrieve tzdata version from /usr/share/zoneinfo/tzdata.zi r21: adapt for timelib 2021.03 (in 8.1.0) @@ -34,8 +35,9 @@ r3: fix a crash if /usr/share/zoneinfo doesn't exist (Raphael Geissert) r2: add filesystem trawl to set up name alias index r1: initial revision + diff --git a/ext/date/config0.m4 b/ext/date/config0.m4 -index 18b8106bd2..3d1f63c758 100644 +index 6b803bf33e..53c3cdb3f4 100644 --- a/ext/date/config0.m4 +++ b/ext/date/config0.m4 @@ -4,6 +4,19 @@ AC_CHECK_HEADERS([io.h]) @@ -59,10 +61,10 @@ index 18b8106bd2..3d1f63c758 100644 timelib_sources="lib/astro.c lib/dow.c lib/parse_date.c lib/parse_tz.c lib/parse_posix.c lib/timelib.c lib/tm2unixtime.c lib/unixtime2tm.c lib/parse_iso_intervals.c lib/interval.c" diff --git a/ext/date/lib/parse_tz.c b/ext/date/lib/parse_tz.c -index e41315efdb..4b6547c0a3 100644 +index c7f93580d7..ec196a98b6 100644 --- a/ext/date/lib/parse_tz.c +++ b/ext/date/lib/parse_tz.c -@@ -26,9 +26,22 @@ +@@ -26,9 +26,33 @@ #include "timelib.h" #include "timelib_private.h" @@ -75,6 +77,17 @@ index e41315efdb..4b6547c0a3 100644 + +#include "php_scandir.h" + ++static const unsigned char internal_utc[] = { ++ 0x54, 0x5a, 0x69, 0x66, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x55, 0x54, 0x43, 0x00, 0x54, 0x5a, 0x69, 0x66, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ++ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, ++ 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x54, 0x43, 0x00, 0x0a, 0x55, 0x54, 0x43, ++ 0x30, 0x0a ++}; ++ +#else #define TIMELIB_SUPPORTS_V2DATA #define TIMELIB_SUPPORT_SLIM_FILE @@ -85,7 +98,7 @@ index e41315efdb..4b6547c0a3 100644 #if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__)) # if defined(__LITTLE_ENDIAN__) -@@ -95,6 +108,11 @@ static int read_php_preamble(const unsigned char **tzf, timelib_tzinfo *tz) +@@ -95,6 +119,11 @@ static int read_php_preamble(const unsigned char **tzf, timelib_tzinfo *tz) { uint32_t version; @@ -97,7 +110,7 @@ index e41315efdb..4b6547c0a3 100644 /* read ID */ version = (*tzf)[3] - '0'; *tzf += 4; -@@ -577,7 +595,467 @@ void timelib_dump_tzinfo(timelib_tzinfo *tz) +@@ -577,7 +606,475 @@ void timelib_dump_tzinfo(timelib_tzinfo *tz) } } @@ -441,6 +454,9 @@ index e41315efdb..4b6547c0a3 100644 + + qsort(db_index, index_next, sizeof *db_index, sysdbcmp); + ++ if (!index_next) { ++ db_index[index_next++].id = strdup("UTC"); ++ } + db->index = db_index; + db->index_size = index_next; + @@ -547,7 +563,12 @@ index e41315efdb..4b6547c0a3 100644 + + fd = open(fname, O_RDONLY); + if (fd == -1) { -+ return NULL; ++ if (strcmp(timezone, "UTC")) { ++ return NULL; ++ } else { ++ *length = sizeof(internal_utc)-1; ++ return internal_utc; ++ } + } else if (fstat(fd, &st) != 0 || !is_valid_tzfile(&st, fd)) { + close(fd); + return NULL; @@ -566,7 +587,7 @@ index e41315efdb..4b6547c0a3 100644 { int left = 0, right = tzdb->index_size - 1; -@@ -603,9 +1081,49 @@ static int seek_to_tz_position(const unsigned char **tzf, const char *timezone, +@@ -603,9 +1100,49 @@ static int seek_to_tz_position(const unsigned char **tzf, const char *timezone, return 0; } @@ -600,7 +621,7 @@ index e41315efdb..4b6547c0a3 100644 + if (timezonedb_system == NULL) { + timelib_tzdb *tmp = malloc(sizeof *tmp); + -+ tmp->version = "0.system"; ++ tmp->version = "0"; + tmp->data = NULL; + create_zone_index(tmp); + retrieve_zone_version(tmp); @@ -616,7 +637,7 @@ index e41315efdb..4b6547c0a3 100644 } const timelib_tzdb_index_entry *timelib_timezone_identifiers_list(const timelib_tzdb *tzdb, int *count) -@@ -617,7 +1135,30 @@ const timelib_tzdb_index_entry *timelib_timezone_identifiers_list(const timelib_ +@@ -617,7 +1154,32 @@ const timelib_tzdb_index_entry *timelib_timezone_identifiers_list(const timelib_ int timelib_timezone_id_is_valid(const char *timezone, const timelib_tzdb *tzdb) { const unsigned char *tzf; @@ -630,7 +651,9 @@ index e41315efdb..4b6547c0a3 100644 + if (timezone[0] == '\0' || strstr(timezone, "..") != NULL) { + return 0; + } -+ ++ if (!strcmp(timezone, "UTC")) { ++ return 1; ++ } + if (system_location_table) { + if (find_zone_info(system_location_table, timezone) != NULL) { + /* found in cache */ @@ -648,7 +671,7 @@ index e41315efdb..4b6547c0a3 100644 } static int skip_64bit_preamble(const unsigned char **tzf, timelib_tzinfo *tz) -@@ -662,6 +1203,8 @@ static timelib_tzinfo* timelib_tzinfo_ctor(const char *name) +@@ -662,6 +1224,8 @@ static timelib_tzinfo* timelib_tzinfo_ctor(const char *name) timelib_tzinfo *timelib_parse_tzfile(const char *timezone, const timelib_tzdb *tzdb, int *error_code) { const unsigned char *tzf; @@ -657,7 +680,7 @@ index e41315efdb..4b6547c0a3 100644 timelib_tzinfo *tmp; int version; int transitions_result, types_result; -@@ -669,7 +1212,7 @@ timelib_tzinfo *timelib_parse_tzfile(const char *timezone, const timelib_tzdb *t +@@ -669,7 +1233,7 @@ timelib_tzinfo *timelib_parse_tzfile(const char *timezone, const timelib_tzdb *t *error_code = TIMELIB_ERROR_NO_ERROR; @@ -666,7 +689,7 @@ index e41315efdb..4b6547c0a3 100644 tmp = timelib_tzinfo_ctor(timezone); version = read_preamble(&tzf, tmp, &type); -@@ -712,11 +1255,36 @@ timelib_tzinfo *timelib_parse_tzfile(const char *timezone, const timelib_tzdb *t +@@ -712,11 +1276,38 @@ timelib_tzinfo *timelib_parse_tzfile(const char *timezone, const timelib_tzdb *t return NULL; } @@ -689,7 +712,9 @@ index e41315efdb..4b6547c0a3 100644 + } + + /* Now done with the mmap segment - discard it. */ -+ munmap(memmap, maplen); ++ if (memmap != internal_utc) { ++ munmap(memmap, maplen); ++ } + } else { +#endif if (type == TIMELIB_TZINFO_PHP) { @@ -704,10 +729,10 @@ index e41315efdb..4b6547c0a3 100644 *error_code = TIMELIB_ERROR_NO_SUCH_TIMEZONE; tmp = NULL; diff --git a/ext/date/php_date.c b/ext/date/php_date.c -index cf4a11b8a2..cd49abc78d 100644 +index 48c82bf7ec..443299c089 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c -@@ -457,7 +457,11 @@ PHP_MINFO_FUNCTION(date) +@@ -490,7 +490,11 @@ PHP_MINFO_FUNCTION(date) php_info_print_table_row(2, "date/time support", "enabled"); php_info_print_table_row(2, "timelib version", TIMELIB_ASCII_VERSION); php_info_print_table_row(2, "\"Olson\" Timezone Database Version", tzdb->version); @@ -137,7 +137,7 @@ Summary: PHP scripting language for creating dynamic web sites Name: %{?scl_prefix}php Version: %{upver}%{?rclower:~%{rclower}}%{?gh_date:.%{gh_date}} -Release: 2%{?dist} +Release: 3%{?dist} # All files licensed under PHP version 3.01, except # Zend is licensed under Zend # TSRM is licensed under BSD @@ -185,7 +185,7 @@ Patch10: php-8.2.0-curl.patch # Use system nikic/php-parser Patch41: php-8.3.0-parser.patch # use system tzdata -Patch43: php-8.1.0-systzdata-v23.patch +Patch43: php-8.3.0-systzdata-v24.patch # See http://bugs.php.net/53436 # + display PHP version backported from 8.4 Patch44: php-7.4.0-phpize.patch @@ -386,8 +386,12 @@ Summary: Common files for PHP License: PHP-3.01 AND BSD-2-Clause %if %{with tzdata} +%if 0%{?fedora} >= 40 || 0%{?rhel} >= 10 +Recommends: tzdata +%else Requires: tzdata %endif +%endif %if %{with libpcre} %global pcre2_buildver %(pkg-config --silence-errors --modversion libpcre2-8 2>/dev/null || echo 10.30) Requires: pcre2%{?_isa} >= %{pcre2_buildver} @@ -671,7 +675,7 @@ The extension is linked with Oracle client libraries %{oraclever} "Oracle Client / Server Interoperability Support" (ID 207303.1). You must install libclntsh.so.%{oraclelib} to use this package, -provided by free Oracle Instant Client RPM available from Oracle on: +provided by Oracle Instant Client RPM available from Oracle on: https://www.oracle.com/database/technologies/instant-client/downloads.html Documentation is at http://php.net/oci8 and http://php.net/pdo_oci @@ -1379,7 +1383,7 @@ export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2 export SKIP_ONLINE_TESTS=1 export SKIP_IO_CAPTURE_TESTS=1 unset TZ LANG LC_ALL -if ! make test TESTS=-j4; then +if ! make test TESTS=%{?_smp_mflags}; then set +x for f in $(find .. -name \*.diff -type f -print); do if ! grep -q XFAIL "${f/.diff/.phpt}" @@ -1874,6 +1878,9 @@ fi %changelog +* Mon Sep 25 2023 Remi Collet <remi@remirepo.net> - 8.3.0~rc2-3 +- add internal UTC if tzdata is missing + * Thu Sep 21 2023 Remi Collet <remi@remirepo.net> - 8.3.0~rc2-2 - use oracle client library version 19.19 on aarch64 - use official Oracle Instant Client RPM |