summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/pkg_edit.php
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2017-06-05 11:23:24 -0400
committerjim-p <jimp@pfsense.org>2017-06-05 11:24:17 -0400
commitde147d3d614c877df2022d85d37256a93047764c (patch)
tree24a976ed3a8e0d8242aa99cf5dde1c77b59e84c9 /src/usr/local/www/pkg_edit.php
parent067a2bdf960a00162915a3a9e514704817fb37c6 (diff)
downloadpfsense-de147d3d614c877df2022d85d37256a93047764c.zip
pfsense-de147d3d614c877df2022d85d37256a93047764c.tar.gz
Add more checks to eliminate empty config tags in package settings. Fixes #7624
Diffstat (limited to 'src/usr/local/www/pkg_edit.php')
-rw-r--r--src/usr/local/www/pkg_edit.php16
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 19cdb1f..fc5f8ce 100644
--- a/src/usr/local/www/pkg_edit.php
+++ b/src/usr/local/www/pkg_edit.php
@@ -86,10 +86,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']);
}
@@ -207,7 +212,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;
OpenPOWER on IntegriCloud