LogentriesCommunity / le_php

Logentries support for PHP
29 stars 17 forks source link

Fixed unsafe timezone issue #12

Closed shanecurran closed 8 years ago

shanecurran commented 8 years ago
shane$ php logentries.php

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 /Users/shane/le_php-master/LeLogger.php on line 404

Set the default timezone in the library to UTC

shanecurran commented 8 years ago

The other option to solve this issue would be to simply mute the warning (place an @ before the date() call), however that is bad practice. It'd be better to solve the issue, even though this fix defaults the timezone of the script to UTC

evert commented 8 years ago

Libraries should not make changes that affect the global state. Including this in the source implies that any application that uses the library, now gets their timezone automatically switched to UTC.

Instead, the application that uses the library should be responsible for also setting their own timezone.