Error with mktime in PHP 5.1 (Technics)

by Andreas Schneider, Saturday, March 23, 2013, 17:03 (4014 days ago)

Hi,

i got an error message in the apache log file and no output for the forum (screen blank).

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 'Europe/Berlin' for 'CET/1.0/no DST' instead in /srv/www/htdocs/virtual/e24/includes/functions.inc.php on line 107


I found no hints for this problem....

Andi

Error with mktime in PHP 5.1

by Andreas Schneider, Saturday, March 23, 2013, 17:13 (4014 days ago) @ Andreas Schneider

Hi,
problem with blank screen is solved (with chmod -R 777 templates_c), but the PHP error still remains.

Andi

Avatar

Error with mktime in PHP 5.1

by Auge ⌂, Sunday, March 24, 2013, 14:00 (4013 days ago) @ Andreas Schneider
edited by Auge, Sunday, March 24, 2013, 14:09

Hello

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 'Europe/Berlin' for 'CET/1.0/no DST' instead in /srv/www/htdocs/virtual/e24/includes/functions.inc.php on line 107


I found no hints for this problem....

I found it:

Every call to a date/time function will generate a E_NOTICE if the time zone is not valid, and/or a E_STRICT or E_WARNING message if using the system settings or the TZ environment variable. See also date_default_timezone_set()

Accentuation by me.

The below specified line numbers refers to mlf 2.3.

Alex sets the default timezone via the function date_default_timezone_set in includes/main.inc.php in the line 92 and in line 111 in the case a registered user has not setted his own timezone. The function daily_actions where the error occurs is called in includes/main.inc.php, line 85 before the default timezone is defined. That said, the function daily_actions uses the system setting or the TZ-database instead. At that point the error occurs.

An untested fix is, to move the function daily_actions to a point after the block where the timezone will be defined (behind line 114).

[edit]A better solution would be the use of a external script, wich is called with a cronjob (if possible) instead the function daily_actions inside the program context.[/edit]

Tschö, Auge

--
Trenne niemals Müll, denn er hat nur eine Silbe!

RSS Feed of thread