Bug #79032 [NEW]: ldap_count_entries returns NULL not FALSE
| From: | admin at feministwiki dot org | Date: | Wed, 25 Dec 2019 15:30:39 +0000 |
| Subject: | Bug #79032 [NEW]: ldap_count_entries returns NULL not FALSE | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-224529@lists.php.net to get a copy of this message | ||
From: admin at feministwiki dot org
Operating system: Ubuntu 16.04 LTS
PHP version: 7.4.1
Package: LDAP related
Bug Type: Bug
Bug description:ldap_count_entries returns NULL not FALSE
Description:
------------
---
From manual page: https://php.net/function.ldap-count-entries
---
When you forget to provide the first argument to ldap_count_entries
(i.e. the link to the LDAP connection), it returns NULL instead of
FALSE.
As per documentation and consistency with other LDAP functions, it
should return FALSE to indicate an error.
Test script:
---------------
$ldapLink = ldap_connect('localhost');
ldap_set_option($ldapLink, LDAP_OPT_PROTOCOL_VERSION, 3);
$memberBase = "ou=members,dc=feministwiki,dc=org";
$userDN = "cn=testuser,$memberBase";
$newUsername = 'whatever';
ldap_bind($ldapLink, $userDN, '[REDACTED]');
$result = ldap_search($ldapLink, $memberBase, 'cn=$newUsername',
array());
var_dump(ldap_count_entries($result)); # First argument missing.
Expected result:
----------------
The function should return FALSE to indicate an error, as per
documentation and consistency with other LDAP functions.
Actual result:
--------------
The function returns NULL.
--
Edit bug report at https://bugs.php.net/bug.php?id=79032&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79032&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79032&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79032&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79032&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79032&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79032&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79032&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79032&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79032&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79032&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79032&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79032&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79032&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79032&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79032&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79032&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79032&r=mysqlcfg