r24892 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r24891‎ | r24892 | r24893 >
Date:03:15, 18 August 2007
Author:laner
Status:old
Tags:
Comment:
* Fixed php warnings triggered when retrieving preferences that didn't exist [http://www.mediawiki.org/wiki/Extension_talk:LDAP_Authentication#PHP_warnings]
Modified paths:
  • /trunk/extensions/LdapAuthentication/LdapAuthentication.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LdapAuthentication/LdapAuthentication.php
@@ -375,10 +375,18 @@
376376
377377 $entry = @ldap_read( $ldapconn, $userdn, "objectclass=*" );
378378 $info = @ldap_get_entries( $ldapconn, $entry );
379 - $this->email = $info[0]["mail"][0];
380 - $this->lang = $info[0]["preferredlanguage"][0];
381 - $this->nickname = $info[0]["displayname"][0];
382 - $this->realname = $info[0]["cn"][0];
 379+ if (isset($info[0]["mail"])) {
 380+ $this->email = $info[0]["mail"][0];
 381+ }
 382+ if (isset($info[0]["preferredlanguage"])) {
 383+ $this->lang = $info[0]["preferredlanguage"][0];
 384+ }
 385+ if (isset($info[0]["displayname"])) {
 386+ $this->nickname = $info[0]["displayname"][0];
 387+ }
 388+ if (isset($info[0]["cn"])) {
 389+ $this->realname = $info[0]["cn"][0];
 390+ }
383391
384392 $this->printDebug( "Retrieved: $this->email, $this->lang, $this->nickname, $this->realname", self::SENSITIVE );
385393 }

Status & tagging log