diff --git a/phpgwapi/inc/class.egw.inc.php b/phpgwapi/inc/class.egw.inc.php index 503684d001..2561bbc498 100644 --- a/phpgwapi/inc/class.egw.inc.php +++ b/phpgwapi/inc/class.egw.inc.php @@ -129,14 +129,20 @@ class egw extends egw_minimal // if no server timezone set, use date_default_timezone_get() to determine it once // it fills to log with deprecated warnings under 5.3 otherwise - if (empty($GLOBALS['egw_info']['server']['server_timezone'])) + if (empty($GLOBALS['egw_info']['server']['server_timezone']) || + $GLOBALS['egw_info']['server']['server_timezone'] == 'System/Localtime') // treat invalid tz like empty! { - $config = new config('phpgwapi'); - $config->read_repository(); - $config->save_value('server_timezone', - $GLOBALS['egw_info']['server']['server_timezone'] = date_default_timezone_get()); - $config->save_repository(); - error_log(__METHOD__."() stored server_timezone=".$GLOBALS['egw_info']['server']['server_timezone']); + try + { + $tz = new DateTimeZone(date_default_timezone_get()); + config::save_value('server_timezone',$GLOBALS['egw_info']['server']['server_timezone'] = $tz->getName(),'phpgwapi'); + error_log(__METHOD__."() stored server_timezone=".$GLOBALS['egw_info']['server']['server_timezone']); + } + catch(Exception $e) + { + // do nothing if new DateTimeZone fails (eg. 'System/Localtime' returned), specially do NOT store it! + error_log(__METHOD__."() NO valid 'date.timezone' set in your php.ini!"); + } } date_default_timezone_set($GLOBALS['egw_info']['server']['server_timezone']); diff --git a/setup/inc/class.setup_process.inc.php b/setup/inc/class.setup_process.inc.php index 628d668c30..39af398422 100755 --- a/setup/inc/class.setup_process.inc.php +++ b/setup/inc/class.setup_process.inc.php @@ -263,9 +263,17 @@ class setup_process { $current_config['system_charset'] = $GLOBALS['egw_setup']->system_charset; } - // storing default timezone as system timezone - $current_config['system_timezone'] = date_default_timezone_get(); - + // storing default timezone as server timezone + try + { + $tz = new DateTimeZone(date_default_timezone_get()); + $current_config['server_timezone'] = $tz->getName(); + } + catch(Exception $e) + { + // do nothing if new DateTimeZone fails (eg. 'System/Localtime' returned), specially do NOT store it! + error_log(__METHOD__."() NO valid 'date.timezone' set in your php.ini!"); + } $current_config['install_id'] = md5($_SERVER['HTTP_HOST'].microtime(true).$GLOBALS['egw_setup']->ConfigDomain); $current_config['postpone_statistics_submit'] = time() + 2 * 30 * 3600; // ask user in 2 month from now, when he has something to report