Setup: Fix backups to keep of 0 gave an error "must be integer"

This commit is contained in:
nathangray 2020-05-12 09:30:55 -06:00
parent 66ee6576f1
commit fa9eda18b8

View File

@ -87,10 +87,10 @@ else
if ($_POST['save_backup_settings']) if ($_POST['save_backup_settings'])
{ {
$matches = array(); $matches = array();
preg_match('/^[1-9][0-9]*$/', $_POST['backup_mincount'], $matches); preg_match('/^\d*$/', $_POST['backup_mincount'], $matches);
$minCount = $matches[0]; $minCount = (int)$matches[0];
$filesBackup = $_POST['backup_files'] === 'backup_files'; $filesBackup = $_POST['backup_files'] === 'backup_files';
if (empty($minCount)) if (empty($minCount) && $matches[0] != '0')
{ {
$minCount = 0; $minCount = 0;
$setup_tpl->set_var('error_msg',htmlspecialchars(lang("'%1' must be integer", lang("backup min count")))); $setup_tpl->set_var('error_msg',htmlspecialchars(lang("'%1' must be integer", lang("backup min count"))));