summaryrefslogtreecommitdiffstats
path: root/src/etc/inc/gwlb.inc
diff options
context:
space:
mode:
authorPhil Davis <phil@jankaritech.com>2017-06-25 08:05:49 +0545
committerPhil Davis <phil@jankaritech.com>2017-06-25 08:05:49 +0545
commitd540ed34d33d44b16606e572024c61bd901569f0 (patch)
treef4573a32133ed2c09d94d013eed8dabfb94e393d /src/etc/inc/gwlb.inc
parent4eb926921c3dead93b2e259e627ce380213695b6 (diff)
downloadpfsense-d540ed34d33d44b16606e572024c61bd901569f0.zip
pfsense-d540ed34d33d44b16606e572024c61bd901569f0.tar.gz
Issue #7659 foreach warning on adding gateway
Signed-off-by: Phil Davis <phil@jankaritech.com>
Diffstat (limited to 'src/etc/inc/gwlb.inc')
-rw-r--r--src/etc/inc/gwlb.inc14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/etc/inc/gwlb.inc b/src/etc/inc/gwlb.inc
index 1e927f5..83c2592 100644
--- a/src/etc/inc/gwlb.inc
+++ b/src/etc/inc/gwlb.inc
@@ -1736,14 +1736,16 @@ function save_gateway($gateway_settings, $realid = "") {
if ($gateway_settings['defaultgw'] == "yes" || $gateway_settings['defaultgw'] == "on") {
$i = 0;
/* remove the default gateway bits for all gateways with the same address family */
- foreach ($a_gateway_item as $gw) {
- if ($gateway['ipprotocol'] == $gw['ipprotocol']) {
- unset($config['gateways']['gateway_item'][$i]['defaultgw']);
- if ($gw['interface'] != $gateway_settings['interface'] && $gw['defaultgw']) {
- $reloadif = $gw['interface'];
+ if (is_array($a_gateway_item)) {
+ foreach ($a_gateway_item as $gw) {
+ if ($gateway['ipprotocol'] == $gw['ipprotocol']) {
+ unset($config['gateways']['gateway_item'][$i]['defaultgw']);
+ if ($gw['interface'] != $gateway_settings['interface'] && $gw['defaultgw']) {
+ $reloadif = $gw['interface'];
+ }
}
+ $i++;
}
- $i++;
}
$gateway['defaultgw'] = true;
}
OpenPOWER on IntegriCloud