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 about 7 years ago. Updated about 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

Also available in: Atom PDF