diff options
author | jim-p <jimp@pfsense.org> | 2017-06-05 11:23:24 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2017-06-21 09:55:45 -0400 |
commit | 4a5faec649e04b6ea9592445048d5997f5d125f8 (patch) | |
tree | 60e63ad81789d0ff442ef167d48a1b9539d80572 /src/usr/local | |
parent | cab08bfb25b20a89c9aa83910512d46fcfba5945 (diff) | |
download | pfsense-4a5faec649e04b6ea9592445048d5997f5d125f8.zip pfsense-4a5faec649e04b6ea9592445048d5997f5d125f8.tar.gz |
Add more checks to eliminate empty config tags in package settings. Fixes #7624
(cherry picked from commit de147d3d614c877df2022d85d37256a93047764c)
Diffstat (limited to 'src/usr/local')
-rw-r--r-- | src/usr/local/www/pkg_edit.php | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/usr/local/www/pkg_edit.php b/src/usr/local/www/pkg_edit.php index 8315c83..18d3f0d 100644 --- a/src/usr/local/www/pkg_edit.php +++ b/src/usr/local/www/pkg_edit.php @@ -124,10 +124,15 @@ if ($config['installedpackages'] && !is_array($config['installedpackages'][xml_s $config['installedpackages'][xml_safe_fieldname($pkg['name'])]['config'] = array(); } -// If the first entry in the array is an empty <config/> tag, kill it. +/* If the first entry in the array is an empty <config/> tag, kill it. + * See the following tickets for more: + * https://redmine.pfsense.org/issues/7624 + * https://redmine.pfsense.org/issues/476 + */ if ($config['installedpackages'] && (count($config['installedpackages'][xml_safe_fieldname($pkg['name'])]['config']) > 0) && - (count($config['installedpackages'][xml_safe_fieldname($pkg['name'])]['config'][0]) == 0)) { + (empty($config['installedpackages'][xml_safe_fieldname($pkg['name'])]['config'][0])) && + is_array($config['installedpackages'][xml_safe_fieldname($pkg['name'])]['config'])) { array_shift($config['installedpackages'][xml_safe_fieldname($pkg['name'])]['config']); } @@ -233,7 +238,12 @@ if ($_POST) { } } - if (isset($id) && $a_pkg[$id]) { + /* If the user supplied an ID and it eixsts, or if id=0 + * and the settings are invalid, overwrite. + * See https://redmine.pfsense.org/issues/7624 + */ + if (isset($id) && ($a_pkg[$id] || + (($id == 0) && !is_array($a_pkg[$id])) )) { $a_pkg[$id] = $pkgarr; } else { $a_pkg[] = $pkgarr; |