cvs: php-src /ext/date php_date.c /ext/date/lib parse_tz.c timelib.h /ext/date/tests date_default_timezone_get-1.phpt
date_default_timezone_get-2.phpt date_default_timezone_set-1.phpt

From: Date: Tue, 20 Dec 2005 19:50:05 +0000
Subject: cvs: php-src /ext/date php_date.c /ext/date/lib parse_tz.c timelib.h /ext/date/tests date_default_timezone_get-1.phpt
date_default_timezone_get-2.phpt date_default_timezone_set-1.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-36087@lists.php.net to get a copy of this message
derick Tue Dec 20 19:50:05 2005 EDT Modified files: /php-src/ext/date php_date.c /php-src/ext/date/lib parse_tz.c timelib.h /php-src/ext/date/tests date_default_timezone_get-1.phpt date_default_timezone_get-2.phpt date_default_timezone_set-1.phpt Log: - Fixed bug #35660 (AIX TZ variable format not understood, yields UTC timezone).

http://cvs.php.net/viewcvs.cgi/php-src/ext/date/php_date.c?r1=1.77&r2=1.78&diff_format=u Index: php-src/ext/date/php_date.c diff -u php-src/ext/date/php_date.c:1.77 php-src/ext/date/php_date.c:1.78 --- php-src/ext/date/php_date.c:1.77 Mon Dec 19 12:57:48 2005 +++ php-src/ext/date/php_date.c Tue Dec 20 19:50:04 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_date.c,v 1.77 2005/12/19 12:57:48 derick Exp $ */ +/* $Id: php_date.c,v 1.78 2005/12/20 19:50:04 derick Exp $ */ #include "php.h" #include "php_streams.h" @@ -103,7 +103,7 @@ {NULL, NULL, NULL} }; -static char* guess_timezone(TSRMLS_D); +static char* guess_timezone(timelib_tzdb *tzdb TSRMLS_DC); static void date_register_classes(TSRMLS_D); /* }}} */ @@ -231,7 +231,9 @@ #define DATE_TZ_ERRMSG \ "It is not safe to rely on the system's timezone settings. Please use " \ "the date.timezone setting, the TZ environment variable or the " \ - "date_default_timezone_set() function. " + "date_default_timezone_set() function. In case you used any of those " \ + "methods and you are still getting this warning, you most likely " \ + "misspelled the timezone identifier. " /* {{{ PHP_MINIT_FUNCTION */ PHP_MINIT_FUNCTION(date) @@ -277,7 +279,7 @@ php_info_print_table_row(2, "date/time support", "enabled"); php_info_print_table_row(2, "Timezone Database Version", tzdb->version); php_info_print_table_row(2, "Timezone Database", php_date_global_timezone_db_enabled ? "external" : "internal"); - php_info_print_table_row(2, "Default timezone", guess_timezone(TSRMLS_C)); + php_info_print_table_row(2, "Default timezone", guess_timezone(tzdb TSRMLS_CC)); php_info_print_table_end(); DISPLAY_INI_ENTRIES(); @@ -302,21 +304,21 @@ /* }}} */ /* {{{ Helper functions */ -static char* guess_timezone(TSRMLS_D) +static char* guess_timezone(timelib_tzdb *tzdb TSRMLS_DC) { char *env; /* Checking configure timezone */ - if (DATEG(timezone) && (strlen(DATEG(timezone)) > 0)) { + if (DATEG(timezone) && (strlen(DATEG(timezone)) > 0) && timelib_timezone_id_is_valid(DATEG(timezone), tzdb)) { return DATEG(timezone); } /* Check environment variable */ env = getenv("TZ"); - if (env && *env) { + if (env && *env && timelib_timezone_id_is_valid(env, tzdb)) { return env; } /* Check config setting for default timezone */ - if (DATEG(default_timezone) && (strlen(DATEG(default_timezone)) > 0)) { + if (DATEG(default_timezone) && (strlen(DATEG(default_timezone)) > 0) && timelib_timezone_id_is_valid(DATEG(default_timezone), tzdb)) { return DATEG(default_timezone); } #if HAVE_TM_ZONE @@ -382,15 +384,10 @@ char *tz; timelib_tzinfo *tzi; - tz = guess_timezone(TSRMLS_C); + tz = guess_timezone(DATE_TIMEZONEDB TSRMLS_CC); tzi = php_date_parse_tzfile(tz, DATE_TIMEZONEDB TSRMLS_CC); if (! tzi) { - php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Timezone setting (date.timezone) or TZ environment variable contains an unknown timezone"); - tzi = php_date_parse_tzfile("UTC", DATE_TIMEZONEDB TSRMLS_CC); - - if (! tzi) { - php_error_docref(NULL TSRMLS_CC, E_ERROR, "Timezone database is corrupt - this should *never* happen!"); - } + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Timezone database is corrupt - this should *never* happen!"); } return tzi; } @@ -1776,6 +1773,10 @@ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &zone, &zone_len) == FAILURE) { RETURN_FALSE; } + if (!timelib_timezone_id_is_valid(zone, DATE_TIMEZONEDB)) { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Timezone ID '%s' is invalid", zone); + RETURN_FALSE; + } if (DATEG(timezone)) { efree(DATEG(timezone)); DATEG(timezone) = NULL; http://cvs.php.net/viewcvs.cgi/php-src/ext/date/lib/parse_tz.c?r1=1.22&r2=1.23&diff_format=u Index: php-src/ext/date/lib/parse_tz.c diff -u php-src/ext/date/lib/parse_tz.c:1.22 php-src/ext/date/lib/parse_tz.c:1.23 --- php-src/ext/date/lib/parse_tz.c:1.22 Mon Oct 3 11:15:20 2005 +++ php-src/ext/date/lib/parse_tz.c Tue Dec 20 19:50:05 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: parse_tz.c,v 1.22 2005/10/03 11:15:20 derick Exp $ */ +/* $Id: parse_tz.c,v 1.23 2005/12/20 19:50:05 derick Exp $ */ #include "timelib.h" @@ -238,6 +238,12 @@ return timezonedb_idx_builtin; } +int timelib_timezone_id_is_valid(char *timezone, timelib_tzdb *tzdb) +{ + char *tzf; + return (seek_to_tz_position((char**) &tzf, timezone, tzdb)); +} + timelib_tzinfo *timelib_parse_tzfile(char *timezone, timelib_tzdb *tzdb) { char *tzf; http://cvs.php.net/viewcvs.cgi/php-src/ext/date/lib/timelib.h?r1=1.17&r2=1.18&diff_format=u Index: php-src/ext/date/lib/timelib.h diff -u php-src/ext/date/lib/timelib.h:1.17 php-src/ext/date/lib/timelib.h:1.18 --- php-src/ext/date/lib/timelib.h:1.17 Mon Dec 19 12:57:49 2005 +++ php-src/ext/date/lib/timelib.h Tue Dec 20 19:50:05 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: timelib.h,v 1.17 2005/12/19 12:57:49 derick Exp $ */ +/* $Id: timelib.h,v 1.18 2005/12/20 19:50:05 derick Exp $ */ #ifndef __TIMELIB_H__ #define __TIMELIB_H__ @@ -67,6 +67,7 @@ void timelib_set_timezone(timelib_time *t, timelib_tzinfo *tz); /* From parse_tz.c */ +int timelib_timezone_id_is_valid(char *timezone, timelib_tzdb *tzdb); timelib_tzinfo *timelib_parse_tzfile(char *timezone, timelib_tzdb *tzdb); int timelib_timestamp_is_in_dst(timelib_sll ts, timelib_tzinfo *tz); timelib_time_offset *timelib_get_time_zone_info(timelib_sll ts, timelib_tzinfo *tz); http://cvs.php.net/viewcvs.cgi/php-src/ext/date/tests/date_default_timezone_get-1.phpt?r1=1.7&r2=1.8&diff_format=u Index: php-src/ext/date/tests/date_default_timezone_get-1.phpt diff -u php-src/ext/date/tests/date_default_timezone_get-1.phpt:1.7 php-src/ext/date/tests/date_default_timezone_get-1.phpt:1.8 --- php-src/ext/date/tests/date_default_timezone_get-1.phpt:1.7 Mon Dec 19 12:57:49 2005 +++ php-src/ext/date/tests/date_default_timezone_get-1.phpt Tue Dec 20 19:50:05 2005 @@ -9,8 +9,8 @@ echo date('e'), "\n"; ?> --EXPECTF-- -Strict Standards: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. We selected 'UTC' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_get-1.php on line 3 +Strict Standards: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_get-1.php on line 3 UTC -Strict Standards: date(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. We selected 'UTC' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_get-1.php on line 4 +Strict Standards: date(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_get-1.php on line 4 UTC http://cvs.php.net/viewcvs.cgi/php-src/ext/date/tests/date_default_timezone_get-2.phpt?r1=1.3&r2=1.4&diff_format=u Index: php-src/ext/date/tests/date_default_timezone_get-2.phpt diff -u php-src/ext/date/tests/date_default_timezone_get-2.phpt:1.3 php-src/ext/date/tests/date_default_timezone_get-2.phpt:1.4 --- php-src/ext/date/tests/date_default_timezone_get-2.phpt:1.3 Wed Oct 19 11:18:16 2005 +++ php-src/ext/date/tests/date_default_timezone_get-2.phpt Tue Dec 20 19:50:05 2005 @@ -8,5 +8,5 @@ echo date_default_timezone_get(), "\n"; ?> --EXPECTF-- -Notice: date_default_timezone_get(): Timezone setting (date.timezone) or TZ environment variable contains an unknown timezone in %sdate_default_timezone_get-2.php on line 3 +Strict Standards: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_get-2.php on line 3 UTC http://cvs.php.net/viewcvs.cgi/php-src/ext/date/tests/date_default_timezone_set-1.phpt?r1=1.7&r2=1.8&diff_format=u Index: php-src/ext/date/tests/date_default_timezone_set-1.phpt diff -u php-src/ext/date/tests/date_default_timezone_set-1.phpt:1.7 php-src/ext/date/tests/date_default_timezone_set-1.phpt:1.8 --- php-src/ext/date/tests/date_default_timezone_set-1.phpt:1.7 Mon Dec 19 12:57:49 2005 +++ php-src/ext/date/tests/date_default_timezone_set-1.phpt Tue Dec 20 19:50:05 2005 @@ -18,9 +18,9 @@ echo date(DATE_ISO8601, $date4), "\n"; ?> --EXPECTF-- -Strict Standards: strtotime(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. We selected 'UTC' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_set-1.php on line 3 +Strict Standards: strtotime(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_set-1.php on line 3 -Strict Standards: strtotime(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. We selected 'UTC' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_set-1.php on line 4 +Strict Standards: strtotime(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'UTC' for 'UTC/0.0/no DST' instead in %sdate_default_timezone_set-1.php on line 4 America/Indiana/Knox 2005-01-12T03:00:00-0500 2005-07-12T03:00:00-0500
« previous php.cvs (#36087) next »