From: Joel dot Brogniart at univ-lyon2 dot fr
Operating system: Mac OS X 10.5.8
PHP version: 5.2.11
PHP Bug Type: LDAP related
Bug description: ldap-get-entries return false instead of an empty array when
there is no error
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 bug report at http://bugs.php.net/?id=50185&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=50185&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=50185&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=50185&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=50185&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=50185&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=50185&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=50185&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=50185&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=50185&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=50185&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=50185&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=50185&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=50185&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=50185&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50185&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50185&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=50185&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=50185&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=50185&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=50185&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=50185&r=mysqlcfg