diff --git a/php-8.1.0-systzdata-v22.patch b/php-8.1.0-systzdata-v24.patch similarity index 91% rename from php-8.1.0-systzdata-v22.patch rename to php-8.1.0-systzdata-v24.patch index d1c8d9096db5d5d9e3011e716ecb506c6ab24eda..ca6e634e228f6914d609e66cd8bb7983ca5909b2 100644 --- a/php-8.1.0-systzdata-v22.patch +++ b/php-8.1.0-systzdata-v24.patch @@ -5,6 +5,8 @@ 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) r20: adapt for timelib 2020.03 (in 8.0.10RC1) @@ -33,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]) @@ -58,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" @@ -74,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 @@ -84,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; @@ -96,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) } } @@ -440,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; + @@ -456,7 +473,7 @@ index e41315efdb..4b6547c0a3 100644 + size_t n; + char *data, *p; + -+ data = malloc(3 * sysdb->index_size + 7); ++ data = malloc(3 * sysdb->index_size + sizeof(FAKE_HEADER) - 1); + + p = mempcpy(data, FAKE_HEADER, sizeof(FAKE_HEADER) - 1); + @@ -546,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); ++ return internal_utc; ++ } + } else if (fstat(fd, &st) != 0 || !is_valid_tzfile(&st, fd)) { + close(fd); + return NULL; @@ -565,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; } @@ -599,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); @@ -615,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; @@ -629,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 */ @@ -647,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; @@ -656,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; @@ -665,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; } @@ -688,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) { @@ -703,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); diff --git a/php-8.1.14.tar.xz.asc b/php-8.1.14.tar.xz.asc deleted file mode 100644 index fe9adc436e461c9f67ebb0b8c9e7a34e5d91edcc..0000000000000000000000000000000000000000 --- a/php-8.1.14.tar.xz.asc +++ /dev/null @@ -1,16 +0,0 @@ ------BEGIN PGP SIGNATURE----- - -iQIzBAABCAAdFiEEObZBND2MEEsrFG3D+cOdwLlphUQFAmO1tsIACgkQ+cOdwLlp -hUQV2xAAm9uAMVqbFlD0ZRMSb3+FAiRXTNB8DKEWcolMpxVTRs50lBp8MlKfpg/X -1QtW9KUSQFce6I6lakkbhj3mYJqXPQjkTUHSZhG52gSh8GOPWwEjudjSMyUYmalK -wj2kV1dMsmkNgWxjOv30qmZQq4fgjGl1zTKX1Z8wTK4MOakdZwlAy4+vI+y/kfuh -oGlLqNthc6m8UUH9lasuZleWyX9CZE+S/6PfgUlAhi6Vov7F6gdh9JawqmOAqIve -+TKZ7vGZ/7JV2RYJwUrevgIe+HHaBkOpGmGyI94RULzhQ7q53TP3ihISA77/qwfM -YRGJTXSttADndlVql95FjxM44cT9CBlnqFzRGs95hiR3YUlsooD4mTlJXLxzjhZQ -QoHFCCXRbeMPl77/qWUNU+xw1qNCcZh2sDyBz+2YOSgFZvWUVJPDmouVNDvIEpC1 -r+A5aoEVQUG6yw7cv8JjtJ9x+YJRenDa26PjuwJwU5pIFb/slbQi0tYdEvze0Z7A -DmwWTkFA9eLVSprQ5xH1wphYtytb7yKhFHs311f+3fgYLqDhbq6fBBnx9dZKfwH4 -qlS894zKdFRyb2fcH4uocJUXs9AlLuGwfyoyeQcavI2tTDvGsM1WLTTzKEkEuo+Y -GzXAqAjyb0l1lFrS5x0cZrYLgvmjd7SoPIonn+Uo1HlWiHOwYbU= -=9naU ------END PGP SIGNATURE----- diff --git a/php-8.2.11.tar.xz b/php-8.2.16.tar.xz similarity index 59% rename from php-8.2.11.tar.xz rename to php-8.2.16.tar.xz index 4c540df506647c95bc0e8dc9f5dda912645986ab..585b21d729422e0be851521b0ab76bc5bc531ece 100644 Binary files a/php-8.2.11.tar.xz and b/php-8.2.16.tar.xz differ diff --git a/php.ini b/php.ini index adb94c7ac18c22870e0dc536b6d58469b9a91ee5..d17e49eb3e6079cfcc3cdf6456ca7cdfe231d30d 100644 --- a/php.ini +++ b/php.ini @@ -929,7 +929,7 @@ cli_server.color = On [Date] ; Defines the default timezone used by the date functions ; https://php.net/date.timezone -;date.timezone = +date.timezone = Asia/Shanghai ; https://php.net/date.default-latitude ;date.default_latitude = 31.7667 diff --git a/php.spec b/php.spec index 5354007440309307b73c103e53dad4671cd3e912..6cec3968ec916b9e63d152df37a2284e4dc0d9fc 100644 --- a/php.spec +++ b/php.spec @@ -42,7 +42,7 @@ Summary: PHP scripting language for creating dynamic web sites Name: php -Version: 8.2.11 +Version: 8.2.16 Release: %{anolis_release}%{?dist} # All files licensed under PHP version 3.01, except # Zend is licensed under Zend @@ -83,7 +83,7 @@ Patch8: php-8.1.0-libdb.patch # Use system nikic/php-parser Patch41: php-8.2.0-parser.patch # use system tzdata -Patch42: php-8.1.0-systzdata-v22.patch +Patch42: php-8.1.0-systzdata-v24.patch # Add check for php headers in phpize Patch43: php-7.4.0-phpize.patch # Use -lldap_r for OpenLDAP @@ -1511,6 +1511,11 @@ systemctl try-restart php-fpm.service >/dev/null 2>&1 || : %changelog +* Fri Feb 16 2024 Funda Wang - 8.2.16-1 +- New version 8.2.16 +- Update systzdata patch +- Set Asia/Shanghai as default timezone + * Fri Sep 29 2023 Funda Wang - 8.2.11-1 - New version 8.2.11