error with Prefs/ldap.php

Atif Ghaffar aghaffar@developer.ch
Thu, 12 Jul 2001 02:20:14 +0200


Hi guys,
I have a stock installation of Horde/IMP latest (updated a couple of
minutes ago)
I am getting this error in IMP
Warning: Undefined offset: 0 in
/u1/usr/apache/htdocs/HORDE/horde/lib/Prefs/ldap.php on line 103

Warning: Cannot add header information - headers already sent by (output
started at /u1/usr/apache/htdocs/HORDE/horde/lib/Prefs/ldap.php:103) in
/u1/usr/apache/htdocs/HORDE/horde/imp/redirect.php on line 61


If I apply the following patch, then this error goes away but I am not
sure if I am doing the right thing.
Please see the patch and advise me accordingly.

thanks

__PATCH__
--- ldap.php.horde      Thu Jul 12 02:18:19 2001
+++ ldap.php.atif       Thu Jul 12 02:09:43 2001
@@ -99,7 +99,7 @@
             $this->params['uid'] . '=' . $this->user,
             array($this->params['uid']));
         $result = ldap_get_entries($conn, $search);
-        if (is_array($result)) {
+       if (is_array($result) && isset($result[0]['dn'])) {
             $this->dn = $result[0]['dn'];
         } else {
             return PREFS_ERROR_CONNECT;
@@ -144,7 +144,7 @@
             $this->params['uid'] . '=' . $this->params['username'],
             array($this->params['uid']));
         $result = ldap_get_entries($this->connection, $search);
-        if (is_array($result)) {
+       if (is_array($result) && isset($result[0]['dn'])) {
             $this->dn = $result[0]['dn'];
             $bind = @ldap_bind($this->connection, $this->dn,
                 $this->params['password']);


__END__PATCH__



-- 
Atif Ghaffar
Internet Development Manager
4unet AG/SA/Ltd.
---------------------------.
          +41 21 351 53 60 ¦ voice
          +41 79 659 89 72 ¦ mobile
          +41 21 254 53 62 ¦ fax
      http://www.4unet.net ¦ www
http://www.atifghaffar.com ¦ homepage
    atif.ghaffar@4unet.net ¦ email