php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #25921 buggy example
Submitted: 2003-10-20 07:34 UTC Modified: 2004-09-24 01:00 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: corinl at gmx dot de Assigned:
Status: No Feedback Package: Documentation problem
PHP Version: 4.3.0 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
22 - 4 = ?
Subscribe to this entry?

 
 [2003-10-20 07:34 UTC] corinl at gmx dot de
Description:
------------
Recently at my site they started to upgrade some directory servers and suddenly stuff started to break. All of them PHP'ish. All LDAP searches broke with "Operations Error". Doing the same queries with ldapsearch (openldap commandline tool) everything looked fine except that I could imagine something going on with the result as I got 'ref: ldap://foo.bar.com/ou=foo,o=bar' back in the chunk coming from the server.

I found a 2-year old workaround for it here: (Surprisingly works flawless.) http://groups.google.se/groups?q=LDAP_OPT_REFERRALS+%2Bfollow+referrals&hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&selm=20011226190121.22738.qmail%40php2.chek.com&rnum=1



Reproduce code:
---------------
        foreach($ldaphosts as $ldaphost)
        {
                if( !$fail && !$success) 
{
                        if( $connect = @ldap_connect($ldaphost) )
                        {
                                if( $bind = @ldap_bind($connect,$ldapbinddn,$lda
pbindpasswd) )
                                {
                                        $filter = "($ldapuserattr=$username)";
                                        $search = @ldap_search($connect
, $ldapbasedn, $filter, array('cn'));
                                        $info = @ldap_get_entries($connect, $sea
rch);
                                        if($info[0]['dn'])
                                        {
                                                if(ldap_bind($connect, $info[0][
'dn'], $password) )
                                                {
                                                        $success = 1;
                                                } else {

                                                        $fail = 1;
                                                }
                                        } else {

                                                $fail = 1;
                                        }
                                }
                        }

                        ldap_unbind($connect);
                }
        }


Expected result:
----------------
ldap_search() to return an ldap search resource to pass on to ldap_get_entries

Actual result:
--------------
ldap_search(): Search: Operations error

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-10-20 07:41 UTC] bugs dot php dot net at phrenetic dot to
I forgot to supply LDAP client library version:

LDAP Support 	enabled
RCS Version 	$Id: ldap.c,v 1.130.2.4 2003/04/30 21:54:02 iliaa Exp $
Total Links 	0/unlimited
API Version 	2004
Vendor Name 	OpenLDAP
Vendor Version 	20123
 [2003-10-20 08:13 UTC] sniper@php.net
That's not workaround, that's how you're supposed to do it.

 [2003-10-20 08:40 UTC] bugs dot php dot net at phrenetic dot to
Then this is a documentation bug. http://se.php.net/manual/en/function.ldap-search.php and http://se.php.net/manual/en/function.ldap-connect.php doesn't say anything about this.
 [2003-10-20 09:32 UTC] betz@php.net
Besides the doc problem, it may also be a "real" bug.
Following draft-ietf-ldapext-ldap-c-api-xx.txt:
LDAP_OPT_REFERRALS (0x08)
[..]
By default, this option is ON.

Is this option ON by default in PHP or not? Following this draft it should be, when not I consider this a bug.

Maybe it is a good idea to add the default options set by PHP to ldap_set_option/ldap_get_option.
 [2004-09-16 15:50 UTC] vrana@php.net
Please explain what exactly do you miss in the documentation.
 [2004-09-24 01:00 UTC] phpdoc at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sat Sep 21 21:01:26 2019 UTC