Project

General

Profile

Actions

Bug #7273

closed

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

Added by Jim Pingle almost 8 years ago. Updated over 7 years ago.

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

100%

Estimated time:
Plus Target Version:
Release Notes:
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.

Actions #1

Updated by Jim Pingle almost 8 years ago

  • Status changed from Assigned to Feedback
  • % Done changed from 0 to 100
Actions #2

Updated by John Murphy over 7 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

Actions #3

Updated by Jim Pingle over 7 years ago

  • Status changed from Feedback to Resolved

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

Thanks for testing

Actions

Also available in: Atom PDF