[turba] Suggestion for sizelimit

Jan Schneider jan at horde.org
Wed Aug 13 17:17:30 PDT 2003


Zitat von Andrew Morgan <morgan at orst.edu>:

> Well, I'm not too worried about fixing this in RELENG myself, so I'd
> rather not kludge something together.  I'll have a look at getting this
> into HEAD though, where it should be a simple change.  Here is the
> current
> code from HEAD:
>
>         /* Send the query to the LDAP server and fetch the matching
> entries. */
>         if (!($res = @ldap_search($this->ds, $this->root, $filter, $attr,
> 0, $sizelimit))) {
>             $this->errno = ldap_errno($this->ds);
>             $this->errstr = ldap_error($this->ds);
>             return PEAR::raiseError($this->errstr);
>         }
>
>         return $this->getResults($fields, $res);
>
>
> I don't have a HEAD installation anywhere, so maybe you can help me with
> the details.  Here is roughly how it should look:
>
>         /* Send the query to the LDAP server and fetch the matching
> entries. */
>         if (!($res = @ldap_search($this->ds, $this->root, $filter, $attr,
> 0, $sizelimit))) {
>             $this->errno = ldap_errno($this->ds);
>             $this->errstr = ldap_error($this->ds);
>             return PEAR::raiseError($this->errstr);
>         }
>
>         if (ldap_errno($this->ds) != 0) {
>             $notification->push(ldap_error($this->ds));
>         }
>
>         return $this->getResults($fields, $res);
>
>
> I'm just taking a guess at how $notification->push() works...  :)

It would be even as easy as:

        if (!($res = @ldap_search($this->ds, $this->root, $filter, $attr,
0, $sizelimit))) {
            $this->errno = ldap_errno($this->ds);
            $this->errstr = ldap_error($this->ds);
            $notification->push($this->errstr, 'horde.error');
        }

BUT: The fact that $this->errno/errstr gets populated might be a hint that
these properties get used/displayed elsewhere. This is without looking at
the actual code. Beside that, if the code is from a library, it should NOT
display any errors to the user but rather return it (as it does now) to the
calling script where it gets pushed on the notification stack.

Jan.

--
http://www.horde.org - The Horde Project
http://www.ammma.de - discover your knowledge
http://www.tip4all.de - Deine private Tippgemeinschaft


More information about the turba mailing list