Skip to content

Commit

Permalink
Merge pull request #170 from AntoineLemarchand/form_rework
Browse files Browse the repository at this point in the history
fix(dbmysql.class.php): try catch in getTimezone
  • Loading branch information
minzords authored Jan 16, 2024
2 parents 7b91bc8 + 8ac61ab commit 440456d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
22 changes: 13 additions & 9 deletions inc/dbmysql.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1670,17 +1670,21 @@ public function getTimezones() {
$from_php = \DateTimeZone::listIdentifiers();
$now = new \DateTime();

$iterator = $this->request([
'SELECT' => 'Name',
'FROM' => 'mysql.time_zone_name',
'WHERE' => ['Name' => $from_php]
]);

while ($from_mysql = $iterator->next()) {
$now->setTimezone(new \DateTimeZone($from_mysql['Name']));
$list[$from_mysql['Name']] = $from_mysql['Name'] . $now->format(" (T P)");
try {
$iterator = $this->request([
'SELECT' => 'Name',
'FROM' => 'mysql.time_zone_name',
'WHERE' => ['Name' => $from_php]
]);
while ($from_mysql = $iterator->next()) {
$now->setTimezone(new \DateTimeZone($from_mysql['Name']));
$list[$from_mysql['Name']] = $from_mysql['Name'] . $now->format(" (T P)");
}
} catch (\Exception $e) {
//do nothing
}


return $list;
}

Expand Down
2 changes: 1 addition & 1 deletion inc/user.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2642,7 +2642,7 @@ function showMyForm($target, $ID) {
'name' => 'language',
'type' => 'select',
'values' => Language::getLanguages(),
'value' => $this->fields['language'] ?? '',
'value' => $this->fields['language'] ?? Session::getPreferredLanguage(),
],
__('Password') => (!$extauth && Session::haveRight("password_update", "1")) ? [
'name' => 'password',
Expand Down

0 comments on commit 440456d

Please sign in to comment.