com php-src: Remove useless date warning: ext/date/php_date .c ext/date/tests/date_default_timezone_get-1.php t
ext/date/tests/date_default_timezone_get-2.phpt ext/date/tests/date_default_timezone_set-1.phpt
| From: | Bob Weinand | Date: | Fri, 27 Feb 2015 22:27:09 +0000 |
| Subject: | com php-src: Remove useless date warning: ext/date/php_date .c ext/date/tests/date_default_timezone_get-1.php t ext/date/tests/date_default_timezone_get-2.phpt ext/date/tests/date_default_timezone_set-1.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-85121@lists.php.net to get a copy of this message | ||
Commit: b22caa81ee2797572279fc9aff0918c01f708de5
Author: Bob Weinand <bobwei9@hotmail.com> Tue, 27 Jan 2015 01:55:19 +0100
Parents: ffe47393abdbe54bfcc892176bab3dba55325cda
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=b22caa81ee2797572279fc9aff0918c01f708de5
Log:
Remove useless date warning
Changed paths:
M ext/date/php_date.c
M ext/date/tests/date_default_timezone_get-1.phpt
M ext/date/tests/date_default_timezone_get-2.phpt
M ext/date/tests/date_default_timezone_set-1.phpt
Diff:
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index fbc4f85..ffdea3d 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 4bff31a...ba06076 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 f58938d..b2f4b82 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 7afa2b1..7e7ba79 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