Bug #51464 [Fbk->NoF]: date_default_timezone_get warnings
| From: | php-bugs at lists dot php dot net | Date: | Mon, 18 Feb 2013 00:34:11 +0000 |
| Subject: | Bug #51464 [Fbk->NoF]: date_default_timezone_get warnings | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-176822@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=51464&edit=1
ID: 51464
Updated by: php-bugs@lists.php.net
Reported by: palmer_m at hotmail dot com
Summary: date_default_timezone_get warnings
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: Date/time related
Operating System: Windows Vista
PHP Version: 5.3.2
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2010-04-02 19:31:30] derick@php.net
I can not reproduce this, the error is properly silenced for me:
derick@kossu:~$ pe 5.3.2
derick@kossu:~$ php -n -derror_reporting=-1 -r '$tz=date_default_timezone_get();'
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 'Europe/London' for
'BST/1.0/DST' instead in Command line code on line 1
derick@kossu:~$ php -n -derror_reporting=-1 -r '$tz=@date_default_timezone_get();'
------------------------------------------------------------------------
[2010-04-02 18:49:33] palmer_m at hotmail dot com
Description:
------------
date_default_timezone_get() issues a notice even if you precede it with an at-sign(@), whenever it
was not set in the .ini file. Consequently, there is no way for the script to prevent the warning
message. It is logical to check the existing timezone value before setting it using
date_default_timezone_set(). The current PHP rules make it impossible to safely use the date
functions when the timezone has not been configured in the .ini file. Also, you cannot tell from
the date_default_timezone_get() function whether or not you need to call date_default_timezone_set()
to prevent further warnings for subsequent date() functions. The reason you cannot tell is because
date_default_timezone_get() does not distinguish the source of its returned value.
Test script:
---------------
$tz=@date_default_timezone_get();
Expected result:
----------------
No visible warning issued to the web user.
Actual result:
--------------
PHP 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 'America/Chicago' for
'-5.0/DST' instead
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=51464&edit=1