|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-10-04 15:56 UTC] cmb@php.net
-Status: Open
+Status: Verified
[2016-10-04 15:56 UTC] cmb@php.net
[2016-10-06 16:05 UTC] derick@php.net
[2016-10-06 18:08 UTC] alec@php.net
[2022-05-20 14:02 UTC] derick@php.net
[2022-06-02 08:25 UTC] git@php.net
[2022-06-02 08:25 UTC] git@php.net
-Status: Verified
+Status: Closed
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 14:00:01 2025 UTC |
Description: ------------ When invalid (or empty date.timezone) is configured DateTime constructor will throw an exception instead of a warning. On PHP7 I can reproduce the issue with invalid date.timezone. It works with empty date.timezone, but it might be environment specific. I have user reports that it throws exception with empty setting. E.g. PHP Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): 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 ... This should not happen.The point of falling back to 'UTC' here is exactly to not throw an exception, no? Test script: --------------- ini_set('date.timezone', 'dummy'); $dt = new DateTime('now'); Expected result: ---------------- no exception. Actual result: -------------- PHP Fatal error: Uncaught Exception: DateTime::__construct(): Invalid date.timezone value 'dummy', we selected the timezone 'UTC' for now. in ...