From b22caa81ee2797572279fc9aff0918c01f708de5 Mon Sep 17 00:00:00 2001 From: Bob Weinand Date: Tue, 27 Jan 2015 01:55:19 +0100 Subject: [PATCH] Remove useless date warning --- ext/date/php_date.c | 12 +++--------- ext/date/tests/date_default_timezone_get-1.phpt | 5 +---- ext/date/tests/date_default_timezone_get-2.phpt | 1 - ext/date/tests/date_default_timezone_set-1.phpt | 5 +---- 4 files changed, 5 insertions(+), 18 deletions(-) diff --git a/ext/date/php_date.c b/ext/date/php_date.c index fbc4f85205..ffdea3d090 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -827,13 +827,6 @@ PHP_RSHUTDOWN_FUNCTION(date) */ #define DATE_FORMAT_COOKIE "l, d-M-Y H:i:s T" -#define DATE_TZ_ERRMSG \ - "It is not safe to rely on the system's timezone settings. You are " \ - "*required* to use the date.timezone setting 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. " - #define SUNFUNCS_RET_TIMESTAMP 0 #define SUNFUNCS_RET_STRING 1 #define SUNFUNCS_RET_DOUBLE 2 @@ -954,7 +947,9 @@ static PHP_INI_MH(OnUpdate_date_timezone) DATEG(timezone_valid) = 0; if (stage == PHP_INI_STAGE_RUNTIME) { if (!timelib_timezone_id_is_valid(DATEG(default_timezone), DATE_TIMEZONEDB)) { - php_error_docref(NULL, E_WARNING, DATE_TZ_ERRMSG); + if (DATEG(default_timezone) && *DATEG(default_timezone)) { + php_error_docref(NULL, E_WARNING, "Invalid date.timezone value '%s', we selected the timezone 'UTC' for now.", DATEG(default_timezone)); + } } else { DATEG(timezone_valid) = 1; } @@ -994,7 +989,6 @@ static char* guess_timezone(const timelib_tzdb *tzdb) return DATEG(default_timezone); } /* Fallback to UTC */ - php_error_docref(NULL, E_WARNING, DATE_TZ_ERRMSG "We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone."); return "UTC"; } diff --git a/ext/date/tests/date_default_timezone_get-1.phpt b/ext/date/tests/date_default_timezone_get-1.phpt index 4bff31a783..ba0607643b 100644 --- a/ext/date/tests/date_default_timezone_get-1.phpt +++ b/ext/date/tests/date_default_timezone_get-1.phpt @@ -12,9 +12,6 @@ date.timezone= echo date_default_timezone_get(), "\n"; echo date('e'), "\n"; ?> ---EXPECTF-- -Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting 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 the timezone 'UTC' for now, but please set date.timezone to select your timezone. in %sdate_default_timezone_get-1.php on line 3 +--EXPECT-- UTC - -Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting 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 the timezone 'UTC' for now, but please set date.timezone to select your timezone. in %sdate_default_timezone_get-1.php on line 4 UTC diff --git a/ext/date/tests/date_default_timezone_get-2.phpt b/ext/date/tests/date_default_timezone_get-2.phpt index f58938d35b..b2f4b8232f 100644 --- a/ext/date/tests/date_default_timezone_get-2.phpt +++ b/ext/date/tests/date_default_timezone_get-2.phpt @@ -12,5 +12,4 @@ date.timezone= echo date_default_timezone_get(), "\n"; ?> --EXPECTF-- -Warning: date_default_timezone_get(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting 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 the timezone 'UTC' for now, but please set date.timezone to select your timezone. in %sdate_default_timezone_get-2.php on line 3 UTC diff --git a/ext/date/tests/date_default_timezone_set-1.phpt b/ext/date/tests/date_default_timezone_set-1.phpt index 7afa2b1a16..7e7ba7972f 100644 --- a/ext/date/tests/date_default_timezone_set-1.phpt +++ b/ext/date/tests/date_default_timezone_set-1.phpt @@ -21,10 +21,7 @@ date.timezone= echo date(DATE_ISO8601, $date3), "\n"; echo date(DATE_ISO8601, $date4), "\n"; ?> ---EXPECTF-- -Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting 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 the timezone 'UTC' for now, but please set date.timezone to select your timezone. in %sdate_default_timezone_set-1.php on line 3 - -Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting 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 the timezone 'UTC' for now, but please set date.timezone to select your timezone. in %sdate_default_timezone_set-1.php on line 4 +--EXPECT-- America/Indiana/Knox 2005-01-12T03:00:00-0500 2005-07-12T03:00:00-0500 -- 2.40.0