Bug #74952 [Opn->Nab]: wrong default timezone is set
Edit report at https://bugs.php.net/bug.php?id=74952&edit=1
ID: 74952
Updated by: derick@php.net
Reported by: jihui dot choi at gmail dot com
Summary: wrong default timezone is set
-Status: Open
+Status: Not a bug
Type: Bug
Package: PHP options/info functions
Operating System: ubuntu linux
PHP Version: 7.0.21
Block user comment: N
Private report: N
New Comment:
PHP does not guess the time zone identifier from the operating system, and unless date.timezone is
set, it will use UTC.
If you check phpinfo() output, and see "0.System" show for «"Olson" Timezone
Database Version», it means you have a patched version of PHP (Ubuntu, and other distributions do
that). As this is not something we endorse, you need to talk to Ubuntu support.
Previous Comments:
------------------------------------------------------------------------
[2017-07-19 11:19:23] jihui dot choi at gmail dot com
Description:
------------
I installed ubuntu linux on my computer with Asia/Seoul timezone.
no problems with it. date command on cli show perfectly correct time.
however on php, date function(or object) shows the time of Pyongyang, unless I change date.timezone
manually in php.ini.
Test script:
---------------
$ date
$ php -r "echo date('Y-m-d H:i:s');"
$ php -r "print_r(new Datetime());"
Expected result:
----------------
the default timezone of php should be followed the system setting correctly.
$ date
Wed Jul 19 20:12:05 KST 2017
$ php -r "echo date('Y-m-d H:i:s');"
2017-07-19 20:12:05
$ php -r "print_r(new Datetime());"
DateTime Object
(
[date] => 2017-07-19 20:12:05.000000
[timezone_type] => 3
[timezone] => Asia/Seoul
)
Actual result:
--------------
$ date
Wed Jul 19 20:12:05 KST 2017
$ php -r "echo date('Y-m-d H:i:s');"
2017-07-19 19:42:01
$ php -r "print_r(new Datetime());"
DateTime Object
(
[date] => 2017-07-19 19:42:21.000000
[timezone_type] => 3
[timezone] => Asia/Pyongyang
)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74952&edit=1
Thread (2 messages)