Thread:Extension talk:LDAP Authentication/Warning: Invalid argument supplied for foreach() in ... /LdapAuthentication/LdapAuthentication.php on line 1304

Hi,

If a user has an entry in LDAP, but is not in any groups, a warning is thrown because the code is trying to iterate over $this->userLDAPGroups["dn"], which doesn't exist. A simple fix to LdapAuthentication.php would be: 1304c1304,1305 < 			foreach ( $this->userLDAPGroups["dn"] as $group ) { --- > 			if($this->userLDAPGroups && array_key_exists("dn", $this->userLDAPGroups)) { > 			   foreach ( $this->userLDAPGroups["dn"] as $group ) { 1307,1308c1308,1309 < 					$this->printDebug( "Found user in a group.", NONSENSITIVE ); < 					return true; --- > 				   $this->printDebug( "Found user in a group.", NONSENSITIVE ); > 				   return true; 1309a1311 > 			   } It might be better to initialize the array properly though.

MediaWiki 	1.15.5 LDAP Authentication Plugin (Version 1.2c) (the code of 1.2d seems similar wrt this bug)

Thanks.