Ticket Hash: cdf773248f83d04dad3175a5ced9e40c170497a1
Title: strtotime() error exception during install
Status: Fixed Type: Code_Defect
Severity: Important Priority: Immediate
Subsystem: Resolution: Fixed
Last Modified: 2014-02-07 23:07:51
Version Found In: 0.5.9
User Comments:

anonymous added on 2013-11-13 08:59:08:

On a Debian 7 (Weezy) machine with Apache 2.4 & PHP 5.4.4

I has not abble to install Garradin because of the following traceback :

> Exception of type ErrorException happened !
> 0 - strtotime(): 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: /home/garradin/include/libs/template_lite/class.template.php:110
> http://garradin.XXXX.org/admin/install.php
> #0 [internal function]: Garradin\exception_error_handler(2, 'strtotime(): It...', '/home/garradin/...', 110, Array)
> #1 /home/garradin/include/libs/template_lite/class.template.php(110): strtotime('2007-01-04 10:3...')
> #2 /home/garradin/include/lib.template.php(22): Template_Lite->Template_Lite()
> #3 /home/garradin/include/lib.template.php(13): Garradin\Template->__construct()
> #4 /home/garradin/include/lib.template.php(40): Garradin\Template::getInstance()
> #5 /home/garradin/include/init.php(225): require('/home/garradin/...')
> #6 [internal function]: Garradin\Loader::load('Garradin\Templa...')
> #7 /home/garradin/www/admin/install.php(62): spl_autoload_call('Garradin\Templa...')
> #8 {main}

This is apparently a PHP security warning since PHP 5.3.


1) For the user: add a `date.timezone` option in the php.ini file 
2) For the Garradin code: add `date_default_timezone_set('UTC');` somewhere in the Garradin code (and after replace `UTC` by what may be set in Garradin options)

For now, maybe be just add an entry to recommend to edit php.ini in the commons errors FAQ

bohwaz added on 2013-11-13 12:57:37:

On Debian, setting date.timezone is not mandatory, as it is read from /etc/localtime.

But the patch was buggy in PHP 5.4.4 and it was corrected in PHP 5.4.6. See [http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=673763#10]

PHP made a big mistake with this warning, the timezone should be read from system time, and not set in php.ini. I'll try to find a way around this strange behaviour in the next release, as it is probably better if the TZ can be defined in the configuration of Garradin, if it differs from the system TZ.

Meanwhile you can get around this by creating a 'config.local.php' file at the root of Garradin with this code:

ini_set('date.timezone', 'Australia/Melbourne');

bohwaz added on 2014-02-07 22:07:51:

RĂ©solu dans [447fcf126adaba93a2b50e13aedadb87478309e3]