Commit 76bb06f7 authored by Manfred Kutas's avatar Manfred Kutas

ZP-1235 Improve guessTZNameFromPHPName.

Released under the Affero GNU General Public License (AGPL) version 3.
parent 37417a63
...@@ -1178,7 +1178,7 @@ class TimezoneUtil { ...@@ -1178,7 +1178,7 @@ class TimezoneUtil {
} }
/** /**
* Tries to find a AS timezone for a php timezone * Tries to find a AS timezone for a php timezone.
* *
* @param string $phpname a php timezone name * @param string $phpname a php timezone name
* *
...@@ -1188,17 +1188,14 @@ class TimezoneUtil { ...@@ -1188,17 +1188,14 @@ class TimezoneUtil {
static private function guessTZNameFromPHPName($phpname) { static private function guessTZNameFromPHPName($phpname) {
foreach (self::$phptimezones as $tzn => $phptzs) { foreach (self::$phptimezones as $tzn => $phptzs) {
if (in_array($phpname, $phptzs)) { if (in_array($phpname, $phptzs)) {
$tzname = $tzn; if (!is_int($tzn)) {
return $tzn;
}
break; break;
} }
} }
ZLog::Write(LOGLEVEL_ERROR, sprintf("TimezoneUtil::guessTZNameFromPHPName() no compatible timezone found for '%s'. Returning 'GMT Standard Time'. Please contact the Z-Push dev team.", $phpname));
if (!isset($tzname) || is_int($tzname)) { return self::$mstzones["085"][0];
ZLog::Write(LOGLEVEL_ERROR, sprintf("TimezoneUtil::guessTZNameFromPHPName() no compatible timezone found for '%s'. Returning 'GMT Standard Time'. Please contact the Z-Push dev team.", $phpname));
return self::$mstzones["085"][0];
}
return $tzname;
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment