summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordoktornotor <notordoktor@gmail.com>2017-03-16 12:46:13 +0100
committerGitHub <noreply@github.com>2017-03-16 12:46:13 +0100
commitce348731b63ea6980dc4f652e76d7c8c7432544c (patch)
tree6ca60007176112c0f40af03c7f337b9d69faa63c
parent803ca43a02863d2086f4affd8c1048c598475bf9 (diff)
downloadpfsense-ce348731b63ea6980dc4f652e76d7c8c7432544c.zip
pfsense-ce348731b63ea6980dc4f652e76d7c8c7432544c.tar.gz
Make sure that array exists before using foreach() (Bug #7399)
-rw-r--r--src/usr/local/www/getserviceproviders.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/usr/local/www/getserviceproviders.php b/src/usr/local/www/getserviceproviders.php
index b9fd2b1..e4d9f91 100644
--- a/src/usr/local/www/getserviceproviders.php
+++ b/src/usr/local/www/getserviceproviders.php
@@ -42,6 +42,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;
}
@@ -59,8 +60,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();
}
}
OpenPOWER on IntegriCloud