summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2012-10-04 10:56:58 +0200
committerRemi Collet <fedora@famillecollet.com>2012-10-04 10:56:58 +0200
commit033ddcbc3ca0de0e3e6858cf2e324fdee9f522cb (patch)
tree23f1240f2efa329d01ec40e8e967e174cf149541
parentb169c229a715523d9ebe95e326ed7830133959f2 (diff)
php 5.4: update systzdata patch to v10, timezone are case insensitive
-rw-r--r--php-5.3.1-systzdata-v10.patch (renamed from php-5.3.1-systzdata-v9.patch)32
-rw-r--r--php54.spec8
2 files changed, 29 insertions, 11 deletions
diff --git a/php-5.3.1-systzdata-v9.patch b/php-5.3.1-systzdata-v10.patch
index f841e9b..b262fae 100644
--- a/php-5.3.1-systzdata-v9.patch
+++ b/php-5.3.1-systzdata-v10.patch
@@ -2,6 +2,7 @@ Add support for use of the system timezone database, rather
than embedding a copy. Discussed upstream but was not desired.
History:
+r10 : make timezone case insensitive
r9: fix another compile error without --with-system-tzdata configured (Michael Heimpold)
r8: fix compile error without --with-system-tzdata configured
r7: improve check for valid timezone id to exclude directories
@@ -18,7 +19,7 @@ r1: initial revision
--- a/ext/date/lib/parse_tz.c
+++ b/ext/date/lib/parse_tz.c
-@@ -24,6 +24,16 @@
+@@ -20,6 +20,16 @@
#include "timelib.h"
@@ -35,7 +36,7 @@ r1: initial revision
#include <stdio.h>
#ifdef HAVE_LOCALE_H
-@@ -35,7 +45,12 @@
+@@ -31,7 +41,12 @@
#else
#include <strings.h>
#endif
@@ -48,7 +49,7 @@ r1: initial revision
#if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__))
# if defined(__LITTLE_ENDIAN__)
-@@ -55,9 +70,14 @@
+@@ -51,9 +66,14 @@
static void read_preamble(const unsigned char **tzf, timelib_tzinfo *tz)
{
@@ -66,7 +67,7 @@ r1: initial revision
/* read BC flag */
tz->bc = (**tzf == '\1');
*tzf += 1;
-@@ -260,7 +280,397 @@ void timelib_dump_tzinfo(timelib_tzinfo
+@@ -256,7 +276,405 @@
}
}
@@ -80,7 +81,7 @@ r1: initial revision
+#endif
+
+/* System timezone database pointer. */
-+static const timelib_tzdb *timezonedb_system = NULL;
++static const timelib_tzdb *timezonedb_system;
+
+/* Hash table entry for the cache of the zone.tab mapping table. */
+struct location_info {
@@ -98,13 +99,14 @@ r1: initial revision
+ * prevent too many collisions. */
+#define LOCINFO_HASH_SIZE (1021)
+
++/* Compute a case insensitive hash of str */
+static uint32_t tz_hash(const char *str)
+{
+ const unsigned char *p = (const unsigned char *)str;
+ uint32_t hash = 5381;
+ int c;
+
-+ while ((c = *p++) != '\0') {
++ while ((c = tolower(*p++)) != '\0') {
+ hash = (hash << 5) ^ hash ^ c;
+ }
+
@@ -442,6 +444,13 @@ r1: initial revision
+ return NULL;
+ }
+
++ if (system_location_table) {
++ const struct location_info *li;
++ if ((li = find_zone_info(system_location_table, timezone)) != NULL) {
++ /* Use the stored name to avoid case issue */
++ timezone = li->name;
++ }
++ }
+ snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", timezone);
+
+ fd = open(fname, O_RDONLY);
@@ -465,7 +474,7 @@ r1: initial revision
{
int left = 0, right = tzdb->index_size - 1;
#ifdef HAVE_SETLOCALE
-@@ -299,36 +709,128 @@ static int seek_to_tz_position(const uns
+@@ -295,36 +713,135 @@
return 0;
}
@@ -537,7 +546,14 @@ r1: initial revision
+ struct stat st;
+
+ if (timezone[0] == '\0' || strstr(timezone, "..") != NULL) {
-+ return 0;
++ return 0;
++ }
++
++ if (system_location_table) {
++ if (find_zone_info(system_location_table, timezone) != NULL) {
++ /* found in cache */
++ return 1;
++ }
+ }
+
+ snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", timezone);
diff --git a/php54.spec b/php54.spec
index cf1adb6..7891c07 100644
--- a/php54.spec
+++ b/php54.spec
@@ -63,7 +63,7 @@ Summary: PHP scripting language for creating dynamic web sites
Name: php
Version: 5.4.8
%if 0%{?snapdate:1}%{?rcver:1}
-Release: 0.1.%{?snapdate}%{?rcver}%{?dist}
+Release: 0.2.%{?snapdate}%{?rcver}%{?dist}
%else
Release: 1%{?dist}
%endif
@@ -104,7 +104,7 @@ Patch22: php-5.4.7-sqlite.patch
# Functional changes
Patch40: php-5.4.0-dlopen.patch
Patch41: php-5.4.0-easter.patch
-Patch42: php-5.3.1-systzdata-v9.patch
+Patch42: php-5.3.1-systzdata-v10.patch
# See http://bugs.php.net/53436
Patch43: php-5.4.0-phpize.patch
# Use system libzip instead of bundled one
@@ -715,7 +715,6 @@ mkdir build-cgi build-apache build-embedded build-zts build-ztscli \
rm -f tests/basic/php_egg_logo_guid.phpt
# affected by systzdata patch
rm -f ext/date/tests/timezone_location_get.phpt
-rm -f ext/standard/tests/general_functions/bug60723.phpt
# https://bugs.php.net/63149 - build against system SQLite
rm -f ext/pdo_sqlite/tests/bug_42589.phpt
# fails sometime
@@ -1501,6 +1500,9 @@ fi
%changelog
+* Thu Oct 4 2012 Remi Collet <RPMS@famillecollet.com> 5.4.8-0.2.RC1
+- update systzdata patch to v10, timezone are case insensitive
+
* Thu Oct 4 2012 Remi Collet <RPMS@famillecollet.com> 5.4.8-0.1.RC1
- update to 5.4.8RC1