Catch DateTime* exceptions (#1488497) - skipping buggy timezones

pull/10/head
Aleksander Machniak 13 years ago
parent 4a5c1f5375
commit 476fa983c0

@ -183,12 +183,15 @@ function rcmail_user_prefs($current=null)
$now = new DateTime(); $now = new DateTime();
foreach (DateTimeZone::listIdentifiers() as $i => $tzs) { foreach (DateTimeZone::listIdentifiers() as $i => $tzs) {
try {
$tz = new DateTimeZone($tzs); $tz = new DateTimeZone($tzs);
$date = new DateTime('2012-12-21', $tz); $date = new DateTime('2012-12-21', $tz);
$offset = $date->format('Z') + 45000; $offset = $date->format('Z') + 45000;
$sortkey = sprintf('%06d.%s', $offset, $tzs); $sortkey = sprintf('%06d.%s', $offset, $tzs);
$zones[$sortkey] = array($tzs, $date->format('P')); $zones[$sortkey] = array($tzs, $date->format('P'));
} }
catch (Exception $e) {}
}
ksort($zones); ksort($zones);
foreach ($zones as $zone) { foreach ($zones as $zone) {

Loading…
Cancel
Save