#50185 [Opn->Csd]: ldap_get_entries() return false instead of an empty array when there is no error
| From: | jani@php.net | Date: | Wed, 18 Nov 2009 17:45:28 +0000 |
| Subject: | #50185 [Opn->Csd]: ldap_get_entries() return false instead of an empty array when there is no error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-144762@lists.php.net to get a copy of this message | ||
ID: 50185
Updated by: jani@php.net
Reported By: Joel dot Brogniart at univ-lyon2 dot fr
-Status: Open
+Status: Closed
Bug Type: LDAP related
Operating System: Mac OS X 10.5.8
PHP Version: 5.2.11
Previous Comments:
------------------------------------------------------------------------
[2009-11-18 17:44:58] svn@php.net
Automatic comment from SVN on behalf of jani
Revision: http://svn.php.net/viewvc/?view=revision&revision=290923
Log: - Fixed bug #50185 (ldap_get_entries() return false instead of an
empty array when there is no error).
# This is also revert of bad patch to bug #48469 and fixes it properly.
------------------------------------------------------------------------
[2009-11-18 06:55:55] Joel dot Brogniart at univ-lyon2 dot fr
Here is a transcript of an interactive PHP session (real user, server,
password modified).
server:~ johndoe$ php -v
PHP 5.2.11 (cli) (built: Sep 28 2009 16:48:57)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
server:~ johndoe$ php -a
Interactive mode enabled
<?php
$ldap_host="ldap.example.com";
$ldap_root="ou=people,dc=example,dc=com";
$ldap_dn="cn=admin,ou=people,dc=example,dc=com";
$ldap_password="fak3pwd";
$attribute_list = array("uid");
$connection = ldap_connect($ldap_host);
printf("ldap_connect error:%s\n", ldap_errno($connection));
$link = @ldap_bind($connection, $ldap_dn, $ldap_password);
printf("ldap_bind error:%s\n", ldap_errno($connection));
$search="(uid=bad_uid)";
$search_result = ldap_search($connection, $ldap_root, $search,
$attribute_list);
printf("ldap_search error:%s\n", ldap_errno($connection));
$info = ldap_get_entries($connection, $search_result);
printf("ldap_get_entries error:%s\n", ldap_errno($connection));
printf("var_dump($info): ");
var_dump($info);
?>
ldap_connect error:0
ldap_bind error:0
ldap_search error:0
ldap_get_entries error:0
var_dump(): NULL
------------------------------------------------------------------------
[2009-11-17 09:20:00] jani@php.net
I'd be quite surprised if this func returned null in PHP 5.2.11 since
there's only code to return FALSE. var_dump($info); to see what it is.
------------------------------------------------------------------------
[2009-11-17 05:27:29] Joel dot Brogniart at univ-lyon2 dot fr
I confirm (and as stated in my description) that ldap-get-entries
return NULL when there is no entries corresponding to the request filter
even when there is no error. No error. And I too think that the new
behavior comes from the change described at
http://bugs.php.net/bug.php?id=48469.
------------------------------------------------------------------------
[2009-11-17 04:40:51] php at group dot apple dot com
This behavior changed in 5.2.9, apparently due to the change associated
with http://bugs.php.net/bug.php?id=48469
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/50185
--
Edit this bug report at http://bugs.php.net/?id=50185&edit=1