summaryrefslogtreecommitdiffstats
path: root/src/usr/local
diff options
context:
space:
mode:
authorNewEraCracker <neweracracker@gmail.com>2016-06-13 21:28:56 +0100
committerStephen Beaver <sbeaver@netgate.com>2016-06-22 11:41:27 -0400
commit2031be9ce3619b0f619e2970b67ec8e6d9fc22b1 (patch)
treea1bbc96d079078c58e1463c4fd05a34bb42a241d /src/usr/local
parent50264b5847b0640867eb87804b21261554f78a94 (diff)
downloadpfsense-2031be9ce3619b0f619e2970b67ec8e6d9fc22b1.zip
pfsense-2031be9ce3619b0f619e2970b67ec8e6d9fc22b1.tar.gz
Fix PHP Warning about invalid argument supplied for foreach
If _POST['members'] or _POST['groups'] is not set / none selected at GUI, it would give a warning on crash reporter (dev versions) (cherry picked from commit 9f4722022f0e8114741e8cf1a421520fded8be1f)
Diffstat (limited to 'src/usr/local')
-rw-r--r--src/usr/local/www/system_groupmanager.php8
-rw-r--r--src/usr/local/www/system_usermanager.php8
2 files changed, 10 insertions, 6 deletions
diff --git a/src/usr/local/www/system_groupmanager.php b/src/usr/local/www/system_groupmanager.php
index 9510084..8e0d253 100644
--- a/src/usr/local/www/system_groupmanager.php
+++ b/src/usr/local/www/system_groupmanager.php
@@ -193,9 +193,11 @@ if (isset($_POST['save'])) {
}
/* Check the POSTed members to ensure they are valid and exist */
- foreach ($_POST['members'] as $newmember) {
- if (!is_numeric($newmember) || empty(getUserEntryByUID($newmember))) {
- $input_errors[] = gettext("One or more invalid group members was submitted.");
+ if(is_array($_POST['members'])) {
+ foreach ($_POST['members'] as $newmember) {
+ if (!is_numeric($newmember) || empty(getUserEntryByUID($newmember))) {
+ $input_errors[] = gettext("One or more invalid group members was submitted.");
+ }
}
}
diff --git a/src/usr/local/www/system_usermanager.php b/src/usr/local/www/system_usermanager.php
index 323f931..bb182ca 100644
--- a/src/usr/local/www/system_usermanager.php
+++ b/src/usr/local/www/system_usermanager.php
@@ -237,9 +237,11 @@ if ($_POST['save']) {
}
/* Check the POSTed groups to ensure they are valid and exist */
- foreach ($_POST['groups'] as $newgroup) {
- if (empty(getGroupEntry($newgroup))) {
- $input_errors[] = gettext("One or more invalid groups was submitted.");
+ if(is_array($_POST['groups'])) {
+ foreach ($_POST['groups'] as $newgroup) {
+ if (empty(getGroupEntry($newgroup))) {
+ $input_errors[] = gettext("One or more invalid groups was submitted.");
+ }
}
}
OpenPOWER on IntegriCloud