ID: 50185 User updated by: Joel dot Brogniart at univ-lyon2 dot fr Reported By: Joel dot Brogniart at univ-lyon2 dot fr -Status: Feedback +Status: Open Bug Type: LDAP related Operating System: Mac OS X 10.5.8 PHP Version: 5.2.11 New Comment:
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. Previous Comments: ------------------------------------------------------------------------ [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 ------------------------------------------------------------------------ [2009-11-16 09:38:24] j...@php.net RTFM: "Returns a complete result information in a multi-dimensional array on success and FALSE on error. " Your query most likely has an error, try check it with ldap_error() ------------------------------------------------------------------------ [2009-11-16 08:50:07] Joel dot Brogniart at univ-lyon2 dot fr Description: ------------ With PHP version < 5.2.10, if the "bad_uid" is not in the LDAP directory and no error occured the following code return an empty array in $info. With PHP version 5.2.10 it return FALSE $info even when there is no error. (simplified code) $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"; $result = array(); $attribute_list = array("uid"); $connection = ldap_connect($ldap_host); $link = @ldap_bind($connection, $ldap_dn, $ldap_password); $search="(uid=bad_uid)"; $search_result = ldap_search($connection, $ldap_root, $search, $attribute_list); $info = ldap_get_entries($connection, $search_result); Reproduce code: --------------- --- >From manual page: function.ldap-get-entries#Return Values --- $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"; $result = array(); $attribute_list = array("uid"); $connection = ldap_connect($ldap_host); $link = @ldap_bind($connection, $ldap_dn, $ldap_password); $search="(uid=bad_uid)"; $search_result = ldap_search($connection, $ldap_root, $search, $attribute_list); $info = ldap_get_entries($connection, $search_result); Expected result: ---------------- $info : Array ( ) Actual result: -------------- $info : ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50185&edit=1