Project

General

Profile

Bug #7273

diag_confbak.php: If a user enters 0 for the number of backups to keep, PHP errors occur

Added by Jim Pingle 9 months ago. Updated 9 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Backup/restore
Target version:
Start date:
02/17/2017
Due date:
% Done:

100%

Affected Version:
2.4
Affected Architecture:

Description

On diag_confbak.php the Backup Count text says to use "0" to keep no backups. The form type is 'number' which prevents 0 from being entered, but if a user's browser isn't honoring that client-side validation, it can still submit 0. When this happens, several PHP errors are encountered:

[17-Feb-2017 12:48:59 America/Indiana/Indianapolis] PHP Warning:  array_keys() expects parameter 1 to be array, null given in /etc/inc/config.lib.inc on line 757
[17-Feb-2017 12:48:59 America/Indiana/Indianapolis] PHP Stack trace:
[17-Feb-2017 12:48:59 America/Indiana/Indianapolis] PHP   1. {main}() /usr/local/www/diag_confbak.php:0
[17-Feb-2017 12:48:59 America/Indiana/Indianapolis] PHP   2. write_config() /usr/local/www/diag_confbak.php:41
[17-Feb-2017 12:48:59 America/Indiana/Indianapolis] PHP   3. cleanup_backupcache() /etc/inc/config.lib.inc:481
[17-Feb-2017 12:48:59 America/Indiana/Indianapolis] PHP   4. array_keys() /etc/inc/config.lib.inc:757
[17-Feb-2017 12:48:59 America/Indiana/Indianapolis] PHP Warning:  in_array() expects parameter 2 to be array, null given in /etc/inc/config.lib.inc on line 757
[17-Feb-2017 12:48:59 America/Indiana/Indianapolis] PHP Stack trace:
[17-Feb-2017 12:48:59 America/Indiana/Indianapolis] PHP   1. {main}() /usr/local/www/diag_confbak.php:0
[17-Feb-2017 12:48:59 America/Indiana/Indianapolis] PHP   2. write_config() /usr/local/www/diag_confbak.php:41
[17-Feb-2017 12:48:59 America/Indiana/Indianapolis] PHP   3. cleanup_backupcache() /etc/inc/config.lib.inc:481
[17-Feb-2017 12:48:59 America/Indiana/Indianapolis] PHP   4. in_array() /etc/inc/config.lib.inc:757

Fixing that to allow 0 would be best.

To me, I've got a fix.

Associated revisions

Revision 3057a2ba
Added by Jim Pingle 9 months ago

Fix handling of 0 for Backup Count. Fixes #7273

History

#1 Updated by Jim Pingle 9 months ago

  • Status changed from Assigned to Feedback
  • % Done changed from 0 to 100

#2 Updated by John Murphy 9 months ago

Setting "Backup Count" to zero does not cause any errors visible from the GUI. In fact, it drops all previously stored configurations which I believe is the expected result of this action.

note to self: setting this to zero removes all previous configuration backups...

Testing environment: SG-2220 w/2.4.0.b.20170301.1546

#3 Updated by Jim Pingle 9 months ago

  • Status changed from Feedback to Resolved

That is, indeed, the desired result. :-)

Thanks for testing

Also available in: Atom PDF