Project

General

Profile

« Previous | Next » 

Revision de147d3d

Added by Jim Pingle about 8 years ago

Add more checks to eliminate empty config tags in package settings. Fixes #7624

View differences:

src/usr/local/www/pkg_edit.php
86 86
	$config['installedpackages'][xml_safe_fieldname($pkg['name'])]['config'] = array();
87 87
}
88 88

  
89
// If the first entry in the array is an empty <config/> tag, kill it.
89
/* If the first entry in the array is an empty <config/> tag, kill it.
90
 * See the following tickets for more:
91
 *  https://redmine.pfsense.org/issues/7624
92
 *  https://redmine.pfsense.org/issues/476
93
 */
90 94
if ($config['installedpackages'] &&
91 95
    (count($config['installedpackages'][xml_safe_fieldname($pkg['name'])]['config']) > 0) &&
92
    (count($config['installedpackages'][xml_safe_fieldname($pkg['name'])]['config'][0]) == 0)) {
96
    (empty($config['installedpackages'][xml_safe_fieldname($pkg['name'])]['config'][0])) &&
97
    is_array($config['installedpackages'][xml_safe_fieldname($pkg['name'])]['config'])) {
93 98
	array_shift($config['installedpackages'][xml_safe_fieldname($pkg['name'])]['config']);
94 99
}
95 100

  
......
207 212
					}
208 213
			}
209 214

  
210
			if (isset($id) && $a_pkg[$id]) {
215
			/* If the user supplied an ID and it eixsts, or if id=0
216
			 * and the settings are invalid, overwrite.
217
			 * See https://redmine.pfsense.org/issues/7624
218
			 */
219
			if (isset($id) && ($a_pkg[$id] ||
220
			   (($id == 0) && !is_array($a_pkg[$id])) )) {
211 221
				$a_pkg[$id] = $pkgarr;
212 222
			} else {
213 223
				$a_pkg[] = $pkgarr;

Also available in: Unified diff