[dev] Fwd: LDAP preferences "undefined property: connection" - patch

Henry Bauer lists.horde.org at henrybauer.com
Thu Jan 1 07:20:36 PST 2004


Oops.  This was not IMP's problem but instead horde's... the file patched was
/horde/lib/Prefs/ldap.php.  Reposting to horde-dev.

Next time I will check more carefully what directory I am in!

Henry

----- Forwarded message from Henry Bauer <lists.horde.org at henrybauer.com> -----
    Date: Thu,  1 Jan 2004 00:19:44 -0500
    From: Henry Bauer <lists.horde.org at henrybauer.com>
Reply-To: Henry Bauer <lists.horde.org at henrybauer.com>
 Subject: LDAP preferences "undefined property: connection" - patch
      To: imp at lists.horde.org

I pulled CVS HEAD today, and after sorting out all the new configuration stuff,
I was still getting errors like:
-------
Notice: Undefined property: connection in
/home/httpd/htdocs/cvshorde/horde/lib/Prefs/ldap.php on line 492

Notice: Undefined property: params in
/home/httpd/htdocs/cvshorde/horde/lib/Prefs/ldap.php on line 492

Notice: Undefined property: params in
/home/httpd/htdocs/cvshorde/horde/lib/Prefs/ldap.php on line 493

Notice: Undefined property: user in
/home/httpd/htdocs/cvshorde/horde/lib/Prefs/ldap.php on line 493

Warning: ldap_search(): supplied argument is not a valid ldap link resource in
/home/httpd/htdocs/cvshorde/horde/lib/Prefs/ldap.php on line 494
-------

Well, I checked out ldap.php and it looks like there are a few misspellings in
there, particularly "$this->connection" vs. "$this->_connection" (the
underscore was missing) and "hordeperson" vs. "hordePerson" (the captial "P"
was
missing).

So, here's a patch.  It cured all the above errors for me.

One question I have is that my copy of 3.2.2 looks for
"mail=username at domain.com" while my copy of CVS HEAD is looking for
"mail=username".  Is this a configuration option I missed or a change in code?
I just added another "mail" attribute, and so now I can run both copies side by
side, but it
kind of bothers me.

Henry

----- End forwarded message -----



-------------- next part --------------
--- lib/Prefs/ldap.php.orig	2003-12-31 21:23:44.000000000 -0500
+++ lib/Prefs/ldap.php	2003-12-31 21:30:20.000000000 -0500
@@ -489,11 +489,11 @@
         /* Entries must have the objectclasses 'top' and 'hordeperson'
          * to successfully store LDAP prefs. Check for both of them,
          * and add them if necessary. */
-        $search = ldap_search($this->connection, $this->params['basedn'],
-                              $this->params['uid'] . '=' . $this->user,
+        $search = ldap_search($this->_connection, $this->_params['basedn'],
+                              $this->_params['uid'] . '=' . $this->_user,
                               array('objectclass'));
         if ($search) {
-            $result = ldap_get_entries($this->connection, $search);
+            $result = ldap_get_entries($this->_connection, $search);
             if ($result) {
                 $top = false;
                 $hordeperson = false;
@@ -501,18 +501,18 @@
                 for ($i = 0; $i < $result[0]['objectclass']['count']; $i++) {
                     if ($result[0]['objectclass'][$i] == 'top') {
                         $top = true;
-                    } elseif ($result[0]['objectclass'][$i] == 'hordeperson') {
+                    } elseif ($result[0]['objectclass'][$i] == 'hordePerson') {
                         $hordeperson = true;
                     }
                 }
 
                 /* Add any missing objectclasses. */
                 if (!$top) {
-                    ldap_mod_add($this->connection, $this->dn, array('objectclass' => 'top'));
+                    ldap_mod_add($this->_connection, $this->_dn, array('objectclass' => 'top'));
                 }
 
                 if (!$hordeperson) {
-                    ldap_mod_add($this->connection, $this->dn, array('objectclass' => 'hordePerson'));
+                    ldap_mod_add($this->_connection, $this->_dn, array('objectclass' => 'hordePerson'));
                 }
             }
         }


More information about the dev mailing list