queryLDAPServer: suppress possible PHP notice
authorAlexey Andriyanov <alan@al-an.info>
Tue, 18 Feb 2014 12:57:12 +0000 (16:57 +0400)
committerAlexey Andriyanov <alan@al-an.info>
Tue, 18 Feb 2014 12:57:12 +0000 (16:57 +0400)
wwwroot/inc/auth.php

index 9db6bbecaaff32e94468d39ee0beaa24f166f4f6..a33f38977e49ed7aed4ac7cc020abeeeca1561bd 100644 (file)
@@ -570,10 +570,11 @@ function queryLDAPServer ($username, $password)
                ldap_free_result ($results);
                $space = '';
                foreach (explode (' ', $LDAP_options['displayname_attrs']) as $attr)
-               {
-                       $ret['displayed_name'] .= $space . $info[0][$attr][0];
-                       $space = ' ';
-               }
+                       if (isset ($info[0][$attr]))
+                       {
+                               $ret['displayed_name'] .= $space . $info[0][$attr][0];
+                               $space = ' ';
+                       }
                // Pull group membership, if any was returned.
                if (isset ($info[0][$LDAP_options['group_attr']]))
                        for ($i = 0; $i < $info[0][$LDAP_options['group_attr']]['count']; $i++)