From 2b214bc1dc2283a22e54eab5769b837df558c487 Mon Sep 17 00:00:00 2001 From: mjollnir_ Date: Sun, 27 Jan 2008 20:05:49 +0000 Subject: [PATCH] Merged from MOODLE_19_STABLE: MDL-13161 - auth/db - suppress php warning when there are no users using db auth --- auth/db/auth.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/auth/db/auth.php b/auth/db/auth.php index 2da10f05bf..239df97e14 100644 --- a/auth/db/auth.php +++ b/auth/db/auth.php @@ -334,10 +334,12 @@ class auth_plugin_db extends auth_plugin_base { // simplify down to usernames $usernames = array(); - foreach ($users as $user) { - array_push($usernames, $user->username); + if (!empty($users)) { + foreach ($users as $user) { + array_push($usernames, $user->username); + } + unset($users); } - unset($users); $add_users = array_diff($userlist, $usernames); unset($usernames); -- 2.39.5