Skip to content

Commit

Permalink
Remove useless date warning
Browse files Browse the repository at this point in the history
  • Loading branch information
bwoebi committed Feb 27, 2015
1 parent ffe4739 commit b22caa8
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 18 deletions.
12 changes: 3 additions & 9 deletions ext/date/php_date.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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";
}

Expand Down
5 changes: 1 addition & 4 deletions ext/date/tests/date_default_timezone_get-1.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion ext/date/tests/date_default_timezone_get-2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 1 addition & 4 deletions ext/date/tests/date_default_timezone_set-1.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b22caa8

Please sign in to comment.