summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--failed.txt2
-rw-r--r--php-8.1.0-timelib.patch106
-rw-r--r--php.spec16
3 files changed, 118 insertions, 6 deletions
diff --git a/failed.txt b/failed.txt
index bb0dbf9..6f892fb 100644
--- a/failed.txt
+++ b/failed.txt
@@ -1,4 +1,4 @@
-===== 8.1.0-DEV (2021-06-04)
+===== 8.1.0-DEV (2021-06-08)
$ grep -ar 'Tests failed' /var/lib/mock/*/build.log
diff --git a/php-8.1.0-timelib.patch b/php-8.1.0-timelib.patch
new file mode 100644
index 0000000..2512829
--- /dev/null
+++ b/php-8.1.0-timelib.patch
@@ -0,0 +1,106 @@
+From f2903432bf8779f32237cc2e620e2fb0ca161ffa Mon Sep 17 00:00:00 2001
+From: Derick Rethans <github@derickrethans.nl>
+Date: Mon, 26 Apr 2021 09:59:01 +0100
+Subject: [PATCH] Fixed issue #112: Support empty POSIX string in older TZif2
+ files
+
+---
+ parse_tz.c | 19 ++++++++++++---
+ tests/c/files/Casablanca_AmazonLinux1 | Bin 0 -> 2428 bytes
+ tests/c/files/Nuuk_AmazonLinux1 | Bin 0 -> 8294 bytes
+ tests/c/parse_posix.cpp | 32 ++++++++++++++++++++++++++
+ timelib.c | 4 +++-
+ timelib.h | 8 ++++---
+ 6 files changed, 56 insertions(+), 7 deletions(-)
+ create mode 100644 tests/c/files/Casablanca_AmazonLinux1
+ create mode 100644 tests/c/files/Nuuk_AmazonLinux1
+
+diff --git a/ext/date/lib/parse_tz.c b/parse_tz.c
+index ffeae2e..4e31b9e 100644
+--- a/ext/date/lib/parse_tz.c
++++ b/ext/date/lib/parse_tz.c
+@@ -553,11 +553,22 @@ void timelib_dump_tzinfo(timelib_tzinfo *tz)
+ timelib_free(date_str);
+ }
+
++ if (!tz->posix_string) {
++ printf("\n%43sNo POSIX string\n", "");
++ return;
++ }
++
++ if (strcmp("", tz->posix_string) == 0) {
++ printf("\n%43sEmpty POSIX string\n", "");
++ return;
++ }
++
+ printf("\n%43sPOSIX string: %s\n", "", tz->posix_string);
+- if (tz->posix_info->std) {
++ if (tz->posix_info && tz->posix_info->std) {
+ trans_str = format_offset_type(tz, tz->posix_info->type_index_std_type);
+ printf("%43sstd: %s\n", "", trans_str);
+ timelib_free(trans_str);
++
+ if (tz->posix_info->dst) {
+ trans_str = format_offset_type(tz, tz->posix_info->type_index_dst_type);
+ printf("%43sdst: %s\n", "", trans_str);
+@@ -693,8 +704,10 @@ timelib_tzinfo *timelib_parse_tzfile(const char *timezone, const timelib_tzdb *t
+ }
+
+ read_posix_string(&tzf, tmp);
+- if (!integrate_posix_string(tmp)) {
+- *error_code = TIMELIB_ERROR_POSIX_MISSING_TTINFO;
++ if (strcmp("", tmp->posix_string) == 0) {
++ *error_code = TIMELIB_ERROR_EMPTY_POSIX_STRING;
++ } else if (!integrate_posix_string(tmp)) {
++ *error_code = TIMELIB_ERROR_CORRUPT_POSIX_STRING;
+ timelib_tzinfo_dtor(tmp);
+ return NULL;
+ }
+diff --git a/ext/date/lib/timelib.c b/timelib.c
+index 8db4df1..92366be 100644
+--- a/ext/date/lib/timelib.c
++++ b/ext/date/lib/timelib.c
+@@ -35,7 +35,7 @@
+
+ #define TIMELIB_LLABS(y) (y < 0 ? (y * -1) : y)
+
+-const char *timelib_error_messages[9] = {
++const char *timelib_error_messages[10] = {
+ "No error",
+ "Can not allocate buffer for parsing",
+ "Corrupt tzfile: The transitions in the file don't always increase",
+@@ -44,6 +44,8 @@ const char *timelib_error_messages[9] = {
+ "The version used in this timezone identifier is unsupported",
+ "No timezone with this name could be found",
+ "A 'slim' timezone file has been detected",
++ "The embedded POSIX string is not valid",
++ "The embedded POSIX string is empty"
+ };
+
+ const char *timelib_get_error_message(int error_code)
+diff --git a/ext/date/lib/timelib.h b/ext/date/lib/timelib.h
+index 7073c6c..8e82e58 100644
+--- a/ext/date/lib/timelib.h
++++ b/ext/date/lib/timelib.h
+@@ -375,7 +375,8 @@ typedef struct _timelib_tzdb {
+ #define TIMELIB_UNSET -99999
+
+ /* An entry for each of these error codes is also in the
+- * timelib_error_messages array in timelib.c */
++ * timelib_error_messages array in timelib.c.
++ * Codes 0x00, 0x07, and 0x09 are warnings only. */
+ #define TIMELIB_ERROR_NO_ERROR 0x00
+ #define TIMELIB_ERROR_CANNOT_ALLOCATE 0x01
+ #define TIMELIB_ERROR_CORRUPT_TRANSITIONS_DONT_INCREASE 0x02
+@@ -383,8 +384,9 @@ typedef struct _timelib_tzdb {
+ #define TIMELIB_ERROR_CORRUPT_NO_ABBREVIATION 0x04
+ #define TIMELIB_ERROR_UNSUPPORTED_VERSION 0x05
+ #define TIMELIB_ERROR_NO_SUCH_TIMEZONE 0x06
+-#define TIMELIB_ERROR_SLIM_FILE 0x07
+-#define TIMELIB_ERROR_POSIX_MISSING_TTINFO 0x08
++#define TIMELIB_ERROR_SLIM_FILE 0x07 /* Warns if the file is SLIM, but we can't read it */
++#define TIMELIB_ERROR_CORRUPT_POSIX_STRING 0x08
++#define TIMELIB_ERROR_EMPTY_POSIX_STRING 0x09 /* Warns if the POSIX string is empty, but still produces results */
+
+ #ifdef __cplusplus
+ extern "C" {
diff --git a/php.spec b/php.spec
index 3b385a1..d9f12e0 100644
--- a/php.spec
+++ b/php.spec
@@ -87,7 +87,7 @@
%bcond_without libgd
# build with system tzdata (2021 required)
-%if 0%{?fedora} >= 33 || 0%{?rhel} >= 8
+%if 0%{?fedora} >= 33 || 0%{?rhel} >= 7
%bcond_without tzdata
%else
%bcond_with tzdata
@@ -113,7 +113,7 @@
Summary: PHP scripting language for creating dynamic web sites
Name: %{?scl_prefix}php
Version: %{upver}%{?lower:~%{lower}}%{?gh_date:.%{gh_date}}
-Release: 1%{?dist}
+Release: 2%{?dist}
# All files licensed under PHP version 3.01, except
# Zend is licensed under Zend
# TSRM is licensed under BSD
@@ -161,8 +161,9 @@ Patch10: php-7.0.7-curl.patch
Patch41: php-8.0.0-parser.patch
# use system tzdata
Patch42: php-8.1.0-systzdata-v20.patch
+Patch43: php-8.1.0-timelib.patch
# See http://bugs.php.net/53436
-Patch43: php-7.4.0-phpize.patch
+Patch44: php-7.4.0-phpize.patch
# Use -lldap_r for OpenLDAP
Patch45: php-7.4.0-ldap_r.patch
# Ignore unsupported "threads" option on password_hash
@@ -225,7 +226,7 @@ BuildRequires: re2c
# used for tests
BuildRequires: /bin/ps
%if %{with tzdata}
-BuildRequires: tzdata >= 2021
+BuildRequires: tzdata
%endif
Requires: httpd-mmn = %{_httpd_mmn}
@@ -933,8 +934,9 @@ in pure PHP.
%patch41 -p1 -b .syslib
%if %{with tzdata}
%patch42 -p1 -b .systzdata
+%patch43 -p1 -b .up
%endif
-%patch43 -p1 -b .headers
+%patch44 -p1 -b .headers
sed -e 's/php-devel/%{?scl_prefix}php-devel/' -i scripts/phpize.in
%if 0%{?fedora} >= 18 || 0%{?rhel} >= 7
%patch45 -p1 -b .ldap_r
@@ -1814,6 +1816,10 @@ fi
%changelog
+* Tue Jun 8 2021 Remi Collet <remi@remirepo.net> - 8.1.0~DEV.20210608-2
+- apply timelib fix for empty POSIX string in older TZif2 files
+- switch back to system tzdata on EL-7
+
* Tue Jun 8 2021 Remi Collet <remi@remirepo.net> - 8.1.0~DEV.20210608-1
- new build
- ignore unsupported "threads" options in password_hash