php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2809 ldap_get_entries returns no values when only retrieving DN
Submitted: 1999-11-23 23:21 UTC Modified: 1999-11-28 18:20 UTC
From: robert dot everett at wcom dot com Assigned: venaas (profile)
Status: Closed Package: LDAP related
PHP Version: 3.0.12 OS: Solaris 2.6
Private report: No CVE-ID: None
 [1999-11-23 23:21 UTC] robert dot everett at wcom dot com
PHP 3.0.12
Apache 1.3.9
Netscape LDAP 4.11
Solaris 2.6

ldap_get_entries() returns false when only retrieving DN. It will also fail
if requesting attributes whose values are all empty.

-- Sometimes OK (CN & DN) --

$ld = ldap_connect("ldap.foobar.com", 389);

$base = "o=Foobar,c=US";
$attrs = array("cn");
$filter = "(uid=testuser)";

$sr = ldap_search($ld, $base, $filter, $attrs);
$info = ldap_get_entries($ld, $sr);

// OK as long as "cn" contains a value; otherwise $info is empty
echo $info[0]["dn"]."<br>";
echo $info[0]["cn"][0]."<br>";

ldap_unbind($ld);

-- Always Fails (DN only) --

$ld = ldap_connect("ldap.foobar.com", 389);

$base = "o=Foobar,c=US";
$attrs = array("dn");
$filter = "(uid=testuser)";

$sr = ldap_search($ld, $base, $filter, $attrs);
$info = ldap_get_entries($ld, $sr);

// fails; $info is always empty
echo $info[0]["dn"]."<br>";

ldap_unbind($ld);

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-11-28 18:20 UTC] venaas at cvs dot php dot net
I've found the bug and fixed it in the CVS tree, so it should be okay in
3.0.13. The bug is actually worse. If one entry has no values for the
specified attributes, no entries at all will be returned.

 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Nov 29 15:03:13 2021 UTC