Project

General

Profile

Bug #676

warning date() on every page

Added by Tim Brouckaert almost 10 years ago. Updated almost 9 years ago.

Status:
Bug resolved
Priority:
Normal
Target version:
Start date:
09/03/2010
Due date:
% Done:

100%

Estimated time:
Complexity:
Normal

Description

on installations with PHP 5.3.x, constant 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 'Europe/Berlin' for 'CET/1.0/no DST' instead in /Users/tim/Sites/chamilo2.0/tracking/lib/data_manager/database.class.php on line 337

solution: add ini_set('date.timezone', 'Europe/Brussels) or date_default_timezone_set('Europe/Brussels') in an config-file.

Occurs only in versions >= 5.3.0

History

#1

Updated by Sven Vanpoucke almost 10 years ago

Very strange since we use a default setting for the timezone and we use the date_default_timezone function already in global.inc.php
You can try to put the default timezone of your server in your php settings to avoid this warning as well

#2

Updated by Tim Brouckaert almost 10 years ago

I get the warning as soon as I log in on the system on index.php.
As soon run.php is called, and I go back to the start (index.php) the warning goes away

Edit: login out, removes the warning, logging back in shows it back, but only on index.php

#3

Updated by Stefaan Vanbillemont almost 10 years ago

  • Target version set to 2
#4

Updated by Tim Brouckaert almost 10 years ago

  • Category set to 21
  • Assignee set to Tim Brouckaert
  • % Done changed from 0 to 50

when adding the lines

$timezone = LocalSetting :: get('platform_timezone');
date_default_timezone_set($timezone);

to line 204-205 problem is solved.

why is there a conditional check on getting timezone in line 285?

#5

Updated by Stefaan Vanbillemont almost 10 years ago

  • Status changed from New to Bug resolved
  • % Done changed from 50 to 100

I implemented your suggested fix after feedback from Sven. We already tested the implementation. Thanks tim!

#6

Updated by Tim Brouckaert almost 10 years ago

Lines seem to have been dissapeared again. Someone who would like to add them again to global/common.inc.php ?

#7

Updated by Stefaan Vanbillemont almost 9 years ago

  • Project changed from Chamilo LCMS Connect to Common
  • Category deleted (21)
#8

Updated by Stefaan Vanbillemont almost 9 years ago

  • Target version changed from 2 to 1.0.0

Also available in: Atom PDF