diff options
author | NewEraCracker <neweracracker@gmail.com> | 2016-08-12 15:55:23 +0100 |
---|---|---|
committer | NewEraCracker <neweracracker@gmail.com> | 2016-08-12 15:55:23 +0100 |
commit | 5eda5816d8a7bd05730c70e44493815079925b48 (patch) | |
tree | 3d79c03c770ab599f31d106e4288e8ef7c1f624b /src | |
parent | 07c208ffa3bba53296ffa774ccaf5ff9afd1b30f (diff) | |
download | pfsense-5eda5816d8a7bd05730c70e44493815079925b48.zip pfsense-5eda5816d8a7bd05730c70e44493815079925b48.tar.gz |
Protect package_reinstall_all()
If one restores a config.xml without packages, there will be a warning about invalid argument supplied for foreach(). This commit fixes the problem.
Diffstat (limited to 'src')
-rw-r--r-- | src/etc/inc/pkg-utils.inc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/etc/inc/pkg-utils.inc b/src/etc/inc/pkg-utils.inc index ac4e18f..4699f68 100644 --- a/src/etc/inc/pkg-utils.inc +++ b/src/etc/inc/pkg-utils.inc @@ -998,6 +998,9 @@ function package_reinstall_all() { FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); unlink_if_exists("{$g['cf_conf_path']}/packages_to_reinstall_after_upgrade.txt"); } else { + if (!isset($config['installedpackages']['package']) || !is_array($config['installedpackages']['package'])) { + return true; + } $package_list = array(); foreach ($config['installedpackages']['package'] as $package) { $package_list[] = get_package_internal_name($package); |