From ce03555abaa16b2e991310c95adc2b7581315dce Mon Sep 17 00:00:00 2001
From: Eduardo Alvarez Fernandez <eduardo.alvarez.fernandez@cern.ch>
Date: Mon, 14 Oct 2019 00:08:52 +0200
Subject: [PATCH] Gix get email address to return address as string and not as
 array

---
 src/CERNLdapService.php | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/CERNLdapService.php b/src/CERNLdapService.php
index 1534afa..4aa2666 100644
--- a/src/CERNLdapService.php
+++ b/src/CERNLdapService.php
@@ -71,8 +71,7 @@ Class CERNLdapService {
   protected function getEmailAddress($entry) {
     $result = ldap_search($this->conn, $entry, "CN=*", array('mail'), NULL, 0);
     $entries = $this->cleanUpEntry(ldap_get_entries($this->conn, $result));    
-    dpm($entries, "Entries");
-    return (array_key_exists('mail', $entries[0])) ? $entries[0]['mail'] : "";
+    return (array_key_exists('mail', $entries[0])) ? $entries[0]['mail'][0] : "";
   
   }
 
@@ -117,4 +116,4 @@ Class CERNLdapService {
   
 
 
-}
\ No newline at end of file
+}
-- 
GitLab