Bug #7273
closeddiag_confbak.php: If a user enters 0 for the number of backups to keep, PHP errors occur
100%
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.
Updated by Jim Pingle almost 8 years ago
- Status changed from Assigned to Feedback
- % Done changed from 0 to 100
Applied in changeset 3057a2ba467c5a4bcda3a004f876a43758d6e129.
Updated by John Murphy almost 8 years 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
Updated by Jim Pingle almost 8 years ago
- Status changed from Feedback to Resolved
That is, indeed, the desired result. :-)
Thanks for testing