diff options
author | Phil Davis <phil.davis@inf.org> | 2015-07-13 00:45:37 +0545 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2015-07-15 10:19:43 -0300 |
commit | 0d9fe84b0929747cc35d755edac7ce2f58a2ac49 (patch) | |
tree | 2472182189b393baf60366a87be27ea25215cd31 | |
parent | 36f90078fbaf12510673f6e08dcf17db36d322fa (diff) | |
download | pfsense-0d9fe84b0929747cc35d755edac7ce2f58a2ac49.zip pfsense-0d9fe84b0929747cc35d755edac7ce2f58a2ac49.tar.gz |
Interfaces PPPs edit avoid foreach() warning
If you go to Interfaces, assign, PPPs, press "+" to add an entry, then press Save without entering anything then you get a warning about the foreach() here.
The is_array() check fixes it.
-rw-r--r-- | usr/local/www/interfaces_ppps_edit.php | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/usr/local/www/interfaces_ppps_edit.php b/usr/local/www/interfaces_ppps_edit.php index 490887f..96ed9cb 100644 --- a/usr/local/www/interfaces_ppps_edit.php +++ b/usr/local/www/interfaces_ppps_edit.php @@ -244,17 +244,19 @@ if ($_POST) { $input_errors[] = gettext("A valid PPPoE reset year must be specified. Don't select a year in the past!"); } - foreach($_POST['interfaces'] as $iface){ - if ($_POST['localip'][$iface] && !is_ipaddr($_POST['localip'][$iface])) - $input_errors[] = sprintf(gettext("A valid local IP address must be specified for %s."),$iface); - if ($_POST['gateway'][$iface] && !is_ipaddr($_POST['gateway'][$iface]) && !is_hostname($_POST['gateway'][$iface])) - $input_errors[] = sprintf(gettext("A valid gateway IP address OR hostname must be specified for %s."),$iface); - if ($_POST['bandwidth'][$iface] && !is_numericint($_POST['bandwidth'][$iface])) - $input_errors[] = sprintf(gettext("The bandwidth value for %s must be an integer."),$iface); - if ($_POST['mtu'][$iface] && ($_POST['mtu'][$iface] < 576)) - $input_errors[] = sprintf(gettext("The MTU for %s must be greater than 576 bytes."),$iface); - if ($_POST['mru'][$iface] && ($_POST['mru'][$iface] < 576)) - $input_errors[] = sprintf(gettext("The MRU for %s must be greater than 576 bytes."),$iface); + if (is_array($_POST['interfaces'])) { + foreach($_POST['interfaces'] as $iface){ + if ($_POST['localip'][$iface] && !is_ipaddr($_POST['localip'][$iface])) + $input_errors[] = sprintf(gettext("A valid local IP address must be specified for %s."),$iface); + if ($_POST['gateway'][$iface] && !is_ipaddr($_POST['gateway'][$iface]) && !is_hostname($_POST['gateway'][$iface])) + $input_errors[] = sprintf(gettext("A valid gateway IP address OR hostname must be specified for %s."),$iface); + if ($_POST['bandwidth'][$iface] && !is_numericint($_POST['bandwidth'][$iface])) + $input_errors[] = sprintf(gettext("The bandwidth value for %s must be an integer."),$iface); + if ($_POST['mtu'][$iface] && ($_POST['mtu'][$iface] < 576)) + $input_errors[] = sprintf(gettext("The MTU for %s must be greater than 576 bytes."),$iface); + if ($_POST['mru'][$iface] && ($_POST['mru'][$iface] < 576)) + $input_errors[] = sprintf(gettext("The MRU for %s must be greater than 576 bytes."),$iface); + } } /* |