|
|
@ -1,3 +1,10 @@ |
|
|
|
From: Debian PHP Maintainers <team+pkg-php@tracker.debian.org> |
|
|
|
Date: Thu, 7 Mar 2019 19:36:30 +0000 |
|
|
|
Subject: Add-support-for-use-of-the-system-timezone-database |
|
|
|
|
|
|
|
# License: MIT |
|
|
|
# http://opensource.org/licenses/MIT |
|
|
|
|
|
|
|
# License: MIT |
|
|
|
# http://opensource.org/licenses/MIT |
|
|
|
|
|
|
@ -5,6 +12,8 @@ Add support for use of the system timezone database, rather |
|
|
|
than embedding a copy. Discussed upstream but was not desired. |
|
|
|
|
|
|
|
History: |
|
|
|
r17: adapt for autotool change in 7.2.16RC1 |
|
|
|
r16: adapt for timelib 2017.06 (in 7.2.3RC1) |
|
|
|
r15: adapt for timelib 2017.05beta7 (in 7.2.0RC1) |
|
|
|
r14: improve check for valid tz file |
|
|
|
r13: adapt for upstream changes to use PHP allocator |
|
|
@ -25,10 +34,39 @@ r4: added "System/Localtime" tzname which uses /etc/localtime |
|
|
|
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 |
|
|
|
---
|
|
|
|
ext/date/config0.m4 | 13 ++ |
|
|
|
ext/date/lib/parse_tz.c | 536 +++++++++++++++++++++++++++++++++++++++++++++++- |
|
|
|
2 files changed, 546 insertions(+), 3 deletions(-) |
|
|
|
|
|
|
|
diff -up ./ext/date/lib/parse_tz.c.systzdata ./ext/date/lib/parse_tz.c
|
|
|
|
--- ./ext/date/lib/parse_tz.c.systzdata 2017-08-22 09:40:38.000000000 +0200
|
|
|
|
+++ ./ext/date/lib/parse_tz.c 2017-08-22 12:16:00.370298079 +0200
|
|
|
|
diff --git a/ext/date/config0.m4 b/ext/date/config0.m4
|
|
|
|
index e464156..00dae8b 100644
|
|
|
|
--- a/ext/date/config0.m4
|
|
|
|
+++ b/ext/date/config0.m4
|
|
|
|
@@ -10,6 +10,19 @@ io.h
|
|
|
|
dnl Check for strtoll, atoll |
|
|
|
AC_CHECK_FUNCS(strtoll atoll) |
|
|
|
|
|
|
|
+PHP_ARG_WITH(system-tzdata, for use of system timezone data,
|
|
|
|
+[ --with-system-tzdata[=DIR] to specify use of system timezone data],
|
|
|
|
+no, no)
|
|
|
|
+
|
|
|
|
+if test "$PHP_SYSTEM_TZDATA" != "no"; then
|
|
|
|
+ AC_DEFINE(HAVE_SYSTEM_TZDATA, 1, [Define if system timezone data is used])
|
|
|
|
+
|
|
|
|
+ if test "$PHP_SYSTEM_TZDATA" != "yes"; then
|
|
|
|
+ AC_DEFINE_UNQUOTED(HAVE_SYSTEM_TZDATA_PREFIX, "$PHP_SYSTEM_TZDATA",
|
|
|
|
+ [Define for location of system timezone data])
|
|
|
|
+ fi
|
|
|
|
+fi
|
|
|
|
+
|
|
|
|
PHP_DATE_CFLAGS="-I@ext_builddir@/lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DHAVE_TIMELIB_CONFIG_H=1" |
|
|
|
timelib_sources="lib/astro.c lib/dow.c lib/parse_date.c lib/parse_tz.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 960e528..501b09e 100644
|
|
|
|
--- a/ext/date/lib/parse_tz.c
|
|
|
|
+++ b/ext/date/lib/parse_tz.c
|
|
|
|
@@ -25,8 +25,21 @@
|
|
|
|
#include "timelib.h" |
|
|
|
#include "timelib_private.h" |
|
|
@ -51,7 +89,7 @@ diff -up ./ext/date/lib/parse_tz.c.systzdata ./ext/date/lib/parse_tz.c |
|
|
|
|
|
|
|
#if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__)) |
|
|
|
# if defined(__LITTLE_ENDIAN__) |
|
|
|
@@ -67,6 +80,11 @@ static int read_php_preamble(const unsig
|
|
|
|
@@ -67,6 +80,11 @@ static int read_php_preamble(const unsigned char **tzf, timelib_tzinfo *tz)
|
|
|
|
{ |
|
|
|
uint32_t version; |
|
|
|
|
|
|
@ -63,7 +101,7 @@ diff -up ./ext/date/lib/parse_tz.c.systzdata ./ext/date/lib/parse_tz.c |
|
|
|
/* read ID */ |
|
|
|
version = (*tzf)[3] - '0'; |
|
|
|
*tzf += 4; |
|
|
|
@@ -374,7 +392,429 @@ void timelib_dump_tzinfo(timelib_tzinfo
|
|
|
|
@@ -374,7 +392,429 @@ void timelib_dump_tzinfo(timelib_tzinfo *tz)
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -266,7 +304,7 @@ diff -up ./ext/date/lib/parse_tz.c.systzdata ./ext/date/lib/parse_tz.c |
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for (l = li[hash]; l; l = l->next) {
|
|
|
|
+ if (strcasecmp(l->name, name) == 0)
|
|
|
|
+ if (timelib_strcasecmp(l->name, name) == 0)
|
|
|
|
+ return l;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
@ -290,7 +328,7 @@ diff -up ./ext/date/lib/parse_tz.c.systzdata ./ext/date/lib/parse_tz.c |
|
|
|
+{
|
|
|
|
+ const timelib_tzdb_index_entry *alpha = first, *beta = second;
|
|
|
|
+
|
|
|
|
+ return strcasecmp(alpha->id, beta->id);
|
|
|
|
+ return timelib_strcasecmp(alpha->id, beta->id);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
@ -493,8 +531,8 @@ diff -up ./ext/date/lib/parse_tz.c.systzdata ./ext/date/lib/parse_tz.c |
|
|
|
+static int inmem_seek_to_tz_position(const unsigned char **tzf, char *timezone, const timelib_tzdb *tzdb)
|
|
|
|
{ |
|
|
|
int left = 0, right = tzdb->index_size - 1; |
|
|
|
#ifdef HAVE_SETLOCALE |
|
|
|
@@ -419,9 +859,48 @@ static int seek_to_tz_position(const uns
|
|
|
|
|
|
|
|
@@ -400,9 +840,48 @@ static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const
|
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
@ -542,8 +580,8 @@ diff -up ./ext/date/lib/parse_tz.c.systzdata ./ext/date/lib/parse_tz.c |
|
|
|
+#endif
|
|
|
|
} |
|
|
|
|
|
|
|
const timelib_tzdb_index_entry *timelib_timezone_identifiers_list(timelib_tzdb *tzdb, int *count) |
|
|
|
@@ -433,7 +912,30 @@ const timelib_tzdb_index_entry *timelib_
|
|
|
|
const timelib_tzdb_index_entry *timelib_timezone_identifiers_list(const timelib_tzdb *tzdb, int *count) |
|
|
|
@@ -414,7 +893,30 @@ const timelib_tzdb_index_entry *timelib_timezone_identifiers_list(const timelib_
|
|
|
|
int timelib_timezone_id_is_valid(char *timezone, const timelib_tzdb *tzdb) |
|
|
|
{ |
|
|
|
const unsigned char *tzf; |
|
|
@ -575,7 +613,7 @@ diff -up ./ext/date/lib/parse_tz.c.systzdata ./ext/date/lib/parse_tz.c |
|
|
|
} |
|
|
|
|
|
|
|
static int skip_64bit_preamble(const unsigned char **tzf, timelib_tzinfo *tz) |
|
|
|
@@ -475,12 +977,14 @@ static timelib_tzinfo* timelib_tzinfo_ct
|
|
|
|
@@ -456,12 +958,14 @@ static timelib_tzinfo* timelib_tzinfo_ctor(char *name)
|
|
|
|
timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb, int *error_code) |
|
|
|
{ |
|
|
|
const unsigned char *tzf; |
|
|
@ -591,7 +629,7 @@ diff -up ./ext/date/lib/parse_tz.c.systzdata ./ext/date/lib/parse_tz.c |
|
|
|
tmp = timelib_tzinfo_ctor(timezone); |
|
|
|
|
|
|
|
version = read_preamble(&tzf, tmp, &type); |
|
|
|
@@ -503,6 +1007,29 @@ timelib_tzinfo *timelib_parse_tzfile(cha
|
|
|
|
@@ -484,6 +988,29 @@ timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb, i
|
|
|
|
timelib_tzinfo_dtor(tmp); |
|
|
|
return NULL; |
|
|
|
} |
|
|
@ -621,7 +659,7 @@ diff -up ./ext/date/lib/parse_tz.c.systzdata ./ext/date/lib/parse_tz.c |
|
|
|
if (version == 2 || version == 3) { |
|
|
|
if (!skip_64bit_preamble(&tzf, tmp)) { |
|
|
|
/* 64 bit preamble is not in place */ |
|
|
|
@@ -520,6 +1047,9 @@ timelib_tzinfo *timelib_parse_tzfile(cha
|
|
|
|
@@ -501,6 +1028,9 @@ timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb, i
|
|
|
|
} else { |
|
|
|
set_default_location_and_comments(&tzf, tmp); |
|
|
|
} |
|
|
@ -631,23 +669,3 @@ diff -up ./ext/date/lib/parse_tz.c.systzdata ./ext/date/lib/parse_tz.c |
|
|
|
} else { |
|
|
|
*error_code = TIMELIB_ERROR_NO_SUCH_TIMEZONE; |
|
|
|
tmp = NULL; |
|
|
|
diff -up ./ext/date/lib/timelib.m4.systzdata ./ext/date/lib/timelib.m4
|
|
|
|
--- ./ext/date/lib/timelib.m4.systzdata 2017-08-22 09:40:38.000000000 +0200
|
|
|
|
+++ ./ext/date/lib/timelib.m4 2017-08-22 11:32:29.357799927 +0200
|
|
|
|
@@ -81,3 +81,16 @@ io.h
|
|
|
|
|
|
|
|
dnl Check for strtoll, atoll |
|
|
|
AC_CHECK_FUNCS(strtoll atoll strftime gettimeofday) |
|
|
|
+
|
|
|
|
+PHP_ARG_WITH(system-tzdata, for use of system timezone data,
|
|
|
|
+[ --with-system-tzdata[=DIR] to specify use of system timezone data],
|
|
|
|
+no, no)
|
|
|
|
+
|
|
|
|
+if test "$PHP_SYSTEM_TZDATA" != "no"; then
|
|
|
|
+ AC_DEFINE(HAVE_SYSTEM_TZDATA, 1, [Define if system timezone data is used])
|
|
|
|
+
|
|
|
|
+ if test "$PHP_SYSTEM_TZDATA" != "yes"; then
|
|
|
|
+ AC_DEFINE_UNQUOTED(HAVE_SYSTEM_TZDATA_PREFIX, "$PHP_SYSTEM_TZDATA",
|
|
|
|
+ [Define for location of system timezone data])
|
|
|
|
+ fi
|
|
|
|
+fi
|