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 3 days ago. Updated 3 days ago.

Status:
Feedback
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 3 days ago

Fix handling of 0 for Backup Count. Fixes #7273

History

#1 Updated by Jim Pingle 3 days ago

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

Also available in: Atom PDF