catch unknown timezone and fall-back to UTC

This commit is contained in:
Bjoern Schiessle 2013-10-08 20:42:35 +02:00
parent 76bdd6bc81
commit 3cf4c46c43
1 changed files with 5 additions and 1 deletions

View File

@ -52,7 +52,11 @@ class OC_Log_Owncloud {
// default to ISO8601
$format = OC_Config::getValue('logdateformat', 'Y-m-d H:i:s');
$logtimezone=OC_Config::getValue( "logtimezone", 'UTC' );
$timezone = new DateTimeZone($logtimezone);
try {
$timezone = new DateTimeZone($logtimezone);
} catch (Exception $e) {
$timezone = new DateTimeZone('UTC');
}
$time = new DateTime(null, $timezone);
$entry=array('app'=>$app, 'message'=>$message, 'level'=>$level, 'time'=> $time->format($format));
$handle = @fopen(self::$logFile, 'a');