]> TLD Linux GIT Repositories - packages/php.git/blobdiff - php-systzdata.patch
- updated to 7.0.2, mostly PLD merge, but TLDized (as usual) and with some patches
[packages/php.git] / php-systzdata.patch
index df06b6f2dc4b2e49db3f8307908958bd8ad09223..a5a7b9d56c8a4df4d12f82f9700da69d9e601dd9 100644 (file)
@@ -1,7 +1,12 @@
 Add support for use of the system timezone database, rather
 than embedding a copy.  Discussed upstream but was not desired.
 
+(Few) upstream reports:
+https://bugs.php.net/bug.php?id=53320
+https://bugs.php.net/bug.php?id=54250
+
 History:
+r13: adapt for upstream changes to use PHP allocator
 r12: adapt for upstream changes for new zic
 r11: use canonical names to avoid more case sensitivity issues
      round lat/long from zone.tab towards zero per builtin db
@@ -20,9 +25,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 -up php-5.6.9RC1/ext/date/lib/parse_tz.c.systzdata php-5.6.9RC1/ext/date/lib/parse_tz.c
---- php-5.6.9RC1/ext/date/lib/parse_tz.c.systzdata     2015-04-30 00:00:18.000000000 +0200
-+++ php-5.6.9RC1/ext/date/lib/parse_tz.c       2015-04-30 06:36:47.019617321 +0200
+diff -up php-7.0.0RC1/ext/date/lib/parse_tz.c.systzdata php-7.0.0RC1/ext/date/lib/parse_tz.c
+--- php-7.0.0RC1/ext/date/lib/parse_tz.c.systzdata     2015-08-18 23:39:24.000000000 +0200
++++ php-7.0.0RC1/ext/date/lib/parse_tz.c       2015-08-22 07:54:38.097258458 +0200
 @@ -20,6 +20,16 @@
  
  #include "timelib.h"
@@ -40,12 +45,12 @@ diff -up php-5.6.9RC1/ext/date/lib/parse_tz.c.systzdata php-5.6.9RC1/ext/date/li
  #include <stdio.h>
  
  #ifdef HAVE_LOCALE_H
-@@ -31,7 +41,12 @@
+@@ -32,8 +42,12 @@
+ #include <strings.h>
  #endif
  
- #define TIMELIB_SUPPORTS_V2DATA
-+
 +#ifndef HAVE_SYSTEM_TZDATA
+ #define TIMELIB_SUPPORTS_V2DATA
  #include "timezonedb.h"
 +#endif
 +
@@ -53,7 +58,7 @@ diff -up php-5.6.9RC1/ext/date/lib/parse_tz.c.systzdata php-5.6.9RC1/ext/date/li
  
  #if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__))
  # if defined(__LITTLE_ENDIAN__)
-@@ -53,6 +68,10 @@ static int read_preamble(const unsigned
+@@ -55,6 +69,11 @@ static int read_preamble(const unsigned
  {
        uint32_t version;
  
@@ -61,10 +66,11 @@ diff -up php-5.6.9RC1/ext/date/lib/parse_tz.c.systzdata php-5.6.9RC1/ext/date/li
 +              *tzf += 20;
 +              return 0;
 +      }
++
        /* read ID */
        version = (*tzf)[3] - '0';
        *tzf += 4;
-@@ -296,7 +315,418 @@ void timelib_dump_tzinfo(timelib_tzinfo
+@@ -298,7 +317,418 @@ void timelib_dump_tzinfo(timelib_tzinfo
        }
  }
  
@@ -102,11 +108,11 @@ diff -up php-5.6.9RC1/ext/date/lib/parse_tz.c.systzdata php-5.6.9RC1/ext/date/li
 +    const unsigned char *p = (const unsigned char *)str;
 +    uint32_t hash = 5381;
 +    int c;
-+    
++
 +    while ((c = tolower(*p++)) != '\0') {
 +        hash = (hash << 5) ^ hash ^ c;
 +    }
-+    
++
 +    return hash % LOCINFO_HASH_SIZE;
 +}
 +
@@ -434,9 +440,9 @@ diff -up php-5.6.9RC1/ext/date/lib/parse_tz.c.systzdata php-5.6.9RC1/ext/date/li
 +{
 +    if (timezonedb_system) {
 +        timelib_tzdb_index_entry *ent, lookup;
-+        
++
 +        lookup.id = (char *)timezone;
-+        
++
 +        ent = bsearch(&lookup, timezonedb_system->index,
 +                      timezonedb_system->index_size, sizeof lookup,
 +                      sysdbcmp);
@@ -484,7 +490,7 @@ diff -up php-5.6.9RC1/ext/date/lib/parse_tz.c.systzdata php-5.6.9RC1/ext/date/li
  {
        int left = 0, right = tzdb->index_size - 1;
  #ifdef HAVE_SETLOCALE
-@@ -335,21 +765,87 @@ static int seek_to_tz_position(const uns
+@@ -337,21 +767,88 @@ static int seek_to_tz_position(const uns
        return 0;
  }
  
@@ -501,9 +507,9 @@ diff -up php-5.6.9RC1/ext/date/lib/parse_tz.c.systzdata php-5.6.9RC1/ext/date/li
 +                      return 0;
 +              }
 +
-+              (*tzf) = (unsigned char *)orig ;
++              (*tzf) = (unsigned char *)orig;
 +              *map = orig;
-+              return 1;
++        return 1;
 +      }
 +      else
 +#endif
@@ -569,11 +575,12 @@ diff -up php-5.6.9RC1/ext/date/lib/parse_tz.c.systzdata php-5.6.9RC1/ext/date/li
 +              return stat(fname, &st) == 0 && is_valid_tzfile(&st);
 +      }
 +#endif
++
 +      return (inmem_seek_to_tz_position(&tzf, timezone, tzdb));
  }
  
  static void skip_64bit_preamble(const unsigned char **tzf, timelib_tzinfo *tz)
-@@ -374,24 +870,54 @@ static void read_64bit_header(const unsi
+@@ -376,24 +873,54 @@ static void read_64bit_header(const unsi
  timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb)
  {
        const unsigned char *tzf;
@@ -607,8 +614,8 @@ diff -up php-5.6.9RC1/ext/date/lib/parse_tz.c.systzdata php-5.6.9RC1/ext/date/li
 +                       * if possible. */
 +
 +                      if ((li = find_zone_info(system_location_table, timezone)) != NULL) {
-+                              tmp->location.comments = strdup(li->comment);
-+                                strncpy(tmp->location.country_code, li->code, 2);
++                              tmp->location.comments = timelib_strdup(li->comment);
++                              strncpy(tmp->location.country_code, li->code, 2);
 +                              tmp->location.longitude = li->longitude;
 +                              tmp->location.latitude = li->latitude;
 +                              tmp->bc = 1;
@@ -616,7 +623,7 @@ diff -up php-5.6.9RC1/ext/date/lib/parse_tz.c.systzdata php-5.6.9RC1/ext/date/li
 +                      else {
 +                              strcpy(tmp->location.country_code, "??");
 +                              tmp->bc = 0;
-+                              tmp->location.comments = strdup("");
++                              tmp->location.comments = timelib_strdup("");
 +                      }
 +
 +                      /* Now done with the mmap segment - discard it. */
@@ -624,6 +631,7 @@ diff -up php-5.6.9RC1/ext/date/lib/parse_tz.c.systzdata php-5.6.9RC1/ext/date/li
 +              } else
 +#endif
 +              {
++                      /* PHP-style - use the embedded info. */
 +                      if (version == 2) {
 +                              skip_64bit_preamble(&tzf, tmp);
 +                              read_64bit_header(&tzf, tmp);
@@ -631,15 +639,14 @@ diff -up php-5.6.9RC1/ext/date/lib/parse_tz.c.systzdata php-5.6.9RC1/ext/date/li
 +                              skip_64bit_types(&tzf, tmp);
 +                              skip_posix_string(&tzf, tmp);
 +                      }
-+                      /* PHP-style - use the embedded info. */
 +                      read_location(&tzf, tmp);
 +              }
        } else {
                tmp = NULL;
        }
-diff -up php-5.6.9RC1/ext/date/lib/timelib.m4.systzdata php-5.6.9RC1/ext/date/lib/timelib.m4
---- php-5.6.9RC1/ext/date/lib/timelib.m4.systzdata     2015-04-30 00:00:18.000000000 +0200
-+++ php-5.6.9RC1/ext/date/lib/timelib.m4       2015-04-30 06:32:08.549500385 +0200
+diff -up php-7.0.0RC1/ext/date/lib/timelib.m4.systzdata php-7.0.0RC1/ext/date/lib/timelib.m4
+--- php-7.0.0RC1/ext/date/lib/timelib.m4.systzdata     2015-08-18 23:39:24.000000000 +0200
++++ php-7.0.0RC1/ext/date/lib/timelib.m4       2015-08-22 07:47:34.854055364 +0200
 @@ -78,3 +78,17 @@ stdlib.h
  
  dnl Check for strtoll, atoll