LoginSignup
12
11

More than 5 years have passed since last update.

PHP7調査(19)date.timezoneの設定がなくても怒られなくなる

Last updated at Posted at 2015-04-16

PHP7から、date.timezoneが設定されていなくてもwarningが出なくなりました。デフォルトのタイムゾーンは今まで通りUTCです。

背景

PHP 5.3.0以降、php.iniでdate.timezoneを設定せずに日付系の関数を呼び出すと下記のようなwarningが表示されていました。

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 Command line code on line 1

しかし、PHPの実行バイナリ1個だけで動かしたいような状況もありうるので、設定ファイル無しでも正しく動作すべきだ、という提案が無事採用されたというわけです。

参照

12
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
11