Skip to content

Commit

Permalink
Handle empty values during config upgrade. Fix #15362
Browse files Browse the repository at this point in the history
The config may have an empty string - use 'empty()' instead of
'isset()' since '0' is not valid in this case.
  • Loading branch information
marcos-ng committed May 31, 2024
1 parent 487d7d5 commit de9a354
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/etc/inc/upgrade_config.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4094,7 +4094,7 @@ function upgrade_130_to_131() {
$gw['interval'] = $gw['interval'] * 1000;
}

if (isset($gw['interval'])) {
if (!empty($gw['interval'])) {
$effective_interval = $gw['interval'];
} else {
$effective_interval = $default_interval;
Expand All @@ -4106,7 +4106,7 @@ function upgrade_130_to_131() {
unset($gw['down']);
}

if (isset($gw['time_period'])) {
if (!empty($gw['time_period'])) {
$effective_time_period = $gw['time_period'];
} else {
$effective_time_period = $default_time_period;
Expand All @@ -4120,7 +4120,7 @@ function upgrade_130_to_131() {
}
}

if (isset($gw['loss_interval'])) {
if (!empty($gw['loss_interval'])) {
$effective_loss_interval = $gw['loss_interval'];
} else {
$effective_loss_interval = $default_loss_interval;
Expand Down

0 comments on commit de9a354

Please sign in to comment.