diff options
author | doktornotor <notordoktor@gmail.com> | 2017-03-16 12:46:13 +0100 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2017-05-02 16:52:07 -0300 |
commit | 7cfca820e633dd99e749a6568a791013961738b7 (patch) | |
tree | ef93082206cd1d8842f7cded0763fc19d1eb0bb6 | |
parent | 877b284ded32a676f7ab49e7a6b8732bde166386 (diff) | |
download | pfsense-7cfca820e633dd99e749a6568a791013961738b7.zip pfsense-7cfca820e633dd99e749a6568a791013961738b7.tar.gz |
Make sure that array exists before using foreach() (Bug #7399)
(cherry picked from commit ce348731b63ea6980dc4f652e76d7c8c7432544c)
-rw-r--r-- | src/usr/local/www/getserviceproviders.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/usr/local/www/getserviceproviders.php b/src/usr/local/www/getserviceproviders.php index 4a02a26..3335179 100644 --- a/src/usr/local/www/getserviceproviders.php +++ b/src/usr/local/www/getserviceproviders.php @@ -74,6 +74,7 @@ function get_country_providers($country) { return is_array($sp['provider'][0]) ? $sp['provider'] : array($sp['provider']); } } + $provider_list = (is_array($provider_list)) ? $provider_list : array(); return $provider_list; } @@ -91,8 +92,12 @@ function country_list() { function providers_list($country) { $serviceproviders = get_country_providers($country); - foreach ($serviceproviders as $sp) { - echo $sp['name']['value'] . "\n"; + if (is_array($serviceproviders)) { + foreach ($serviceproviders as $sp) { + echo $sp['name']['value'] . "\n"; + } + } else { + $serviceproviders = array(); } } |