* Tue Nov 4 2008 Joe Orton <jorton@redhat.com> 5.2.6-6

- move gd_README to php-gd
- update to r4 of systzdata patch; introduces a default timezone
  name of "System/Localtime", which uses /etc/localtime (#469532)
This commit is contained in:
jorton 2008-11-04 11:26:35 +00:00
parent 896c0914a8
commit 1629d21b64
2 changed files with 74 additions and 37 deletions

View File

@ -3,32 +3,13 @@ Add support for use of the system timezone database, rather
than embedding a copy. Discussed upstream but was not desired.
History:
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
--- php-5.2.5/ext/date/lib/timelib.m4.systzdata
+++ php-5.2.5/ext/date/lib/timelib.m4
@@ -78,3 +78,17 @@ stdlib.h
dnl Check for strtoll, atoll
AC_CHECK_FUNCS(strtoll atoll strftime)
+
+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-5.2.5/ext/date/lib/parse_tz.c.systzdata
+++ php-5.2.5/ext/date/lib/parse_tz.c
--- php-5.2.6/ext/date/lib/parse_tz.c.systzdata
+++ php-5.2.6/ext/date/lib/parse_tz.c
@@ -20,6 +20,16 @@
#include "timelib.h"
@ -57,7 +38,7 @@ r1: initial revision
#if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__))
# if defined(__LITTLE_ENDIAN__)
@@ -206,6 +219,195 @@ void timelib_dump_tzinfo(timelib_tzinfo
@@ -206,6 +219,211 @@ void timelib_dump_tzinfo(timelib_tzinfo
}
}
@ -69,6 +50,8 @@ r1: initial revision
+#define ZONEINFO_PREFIX "/usr/share/zoneinfo"
+#endif
+
+#define SYSTEM_TZFILE "/etc/localtime"
+
+static const timelib_tzdb *timezonedb_system = NULL;
+
+/* Filter out some non-tzdata files and the posix/right databases, if
@ -168,17 +151,24 @@ r1: initial revision
+static char *map_tzfile(const char *timezone, size_t *length)
+{
+ char fname[PATH_MAX];
+ const char *fn;
+ struct stat st;
+ char *p;
+ int fd;
+
+ if (strstr(timezone, "..") != NULL) {
+ return NULL;
+ if (strcmp(timezone, TIMELIB_SYSTEM_TZID) == 0) {
+ fn = SYSTEM_TZFILE;
+ }
+ else {
+ if (strstr(timezone, "..") != NULL) {
+ return NULL;
+ }
+
+ snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", timezone);
+ fn = fname;
+ }
+
+ snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", timezone);
+
+ fd = open(fname, O_RDONLY);
+ fd = open(fn, O_RDONLY);
+ if (fd == -1) {
+ return NULL;
+ } else if (fstat(fd, &st) != 0 || st.st_size < 21) {
@ -216,14 +206,21 @@ r1: initial revision
+int timelib_timezone_id_is_valid(char *timezone, const timelib_tzdb *tzdb)
+{
+ char fname[PATH_MAX];
+ const char *fn;
+
+ if (strstr(timezone, "..") != NULL) {
+ return 0;
+ if (strcmp(timezone, TIMELIB_SYSTEM_TZID) == 0) {
+ fn = SYSTEM_TZFILE;
+ }
+ else {
+ if (strstr(timezone, "..") != NULL) {
+ return 0;
+ }
+
+ snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", timezone);
+ fn = fname;
+ }
+
+ snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", timezone);
+
+ return access(fname, R_OK) == 0 ? 1 : 0;
+ return access(fn, R_OK) == 0 ? 1 : 0;
+}
+
+timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb)
@ -253,7 +250,7 @@ r1: initial revision
static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const timelib_tzdb *tzdb)
{
int left = 0, right = tzdb->index_size - 1;
@@ -279,6 +481,7 @@ timelib_tzinfo *timelib_parse_tzfile(cha
@@ -279,6 +497,7 @@ timelib_tzinfo *timelib_parse_tzfile(cha
return tmp;
}
@ -261,3 +258,37 @@ r1: initial revision
static ttinfo* fetch_timezone_offset(timelib_tzinfo *tz, timelib_sll ts, timelib_sll *transition_time)
{
--- php-5.2.6/ext/date/lib/timelib.m4.systzdata
+++ php-5.2.6/ext/date/lib/timelib.m4
@@ -78,3 +78,17 @@ stdlib.h
dnl Check for strtoll, atoll
AC_CHECK_FUNCS(strtoll atoll strftime)
+
+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-5.2.6/ext/date/php_date.c.systzdata
+++ php-5.2.6/ext/date/php_date.c
@@ -584,6 +584,11 @@ static char* guess_timezone(const timeli
if (DATEG(default_timezone) && (strlen(DATEG(default_timezone)) > 0) && timelib_timezone_id_is_valid(DATEG(default_timezone), tzdb)) {
return DATEG(default_timezone);
}
+#ifdef TIMELIB_SYSTEM_TZID
+ if (timelib_timezone_id_is_valid(TIMELIB_SYSTEM_TZID, tzdb)) {
+ return TIMELIB_SYSTEM_TZID;
+ }
+#endif
#if HAVE_TM_ZONE
/* Try to guess timezone from system information */
{

View File

@ -8,7 +8,7 @@
Summary: The PHP HTML-embedded scripting language
Name: php
Version: 5.2.6
Release: 5
Release: 6
License: PHP
Group: Development/Languages
URL: http://www.php.net/
@ -33,7 +33,7 @@ Patch24: php-5.2.3-macropen.patch
# Functional changes
Patch30: php-5.0.4-dlopen.patch
Patch31: php-5.2.4-easter.patch
Patch32: php-5.2.5-systzdata.patch
Patch32: php-5.2.6-systzdata.patch
# Fixes for tests
Patch50: php-5.2.4-tests-dashn.patch
@ -675,7 +675,7 @@ rm files.* macros.php
%files common -f files.common
%defattr(-,root,root)
%doc CODING_STANDARDS CREDITS EXTENSIONS INSTALL LICENSE NEWS README*
%doc Zend/ZEND_* gd_README TSRM_LICENSE regex_COPYRIGHT
%doc Zend/ZEND_* TSRM_LICENSE regex_COPYRIGHT
%config(noreplace) %{_sysconfdir}/php.ini
%dir %{_sysconfdir}/php.d
%dir %{_libdir}/php
@ -717,6 +717,7 @@ rm files.* macros.php
%files mbstring -f files.mbstring
%files ncurses -f files.ncurses
%files gd -f files.gd
%doc gd_README
%files soap -f files.soap
%files bcmath -f files.bcmath
%files dba -f files.dba
@ -728,6 +729,11 @@ rm files.* macros.php
%files pspell -f files.pspell
%changelog
* Tue Nov 4 2008 Joe Orton <jorton@redhat.com> 5.2.6-6
- move gd_README to php-gd
- update to r4 of systzdata patch; introduces a default timezone
name of "System/Localtime", which uses /etc/localtime (#469532)
* Sat Sep 13 2008 Remi Collet <Fedora@FamilleCollet.com> 5.2.6-5
- enable XPM support in php-gd
- Fix BR for php-gd