[php-src] Issue #7998: ldap_search not working with base=NULL after php7.1
| From: | dab18 | Date: | Tue, 25 Jan 2022 07:32:48 +0000 |
| Subject: | [php-src] Issue #7998: ldap_search not working with base=NULL after php7.1 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-239286@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/7998
Author: dab18
### Description
The following code:
```php
<?php
$ds = ldap_connect(); // <-- URI from /etc/openldap/ldap.conf
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
$sr = ldap_search($ds, NULL, "(uid=dab)", array("dn")); // <-- BASE from
/etc/openldap/ldap.conf
$entry = ldap_first_entry($ds, $sr);
var_dump($entry);
```
Resulted in this output:
```
Warning: ldap_search(): Search: No such object in test.php on line 5
```
But I expected this output instead:
```
resource(6) of type (ldap result entry)
```
/etc/openldap/ldap.conf:
BASE c=ru
URI ldap://localhost
slapd.log:
slapd[14091]: conn=4230791 op=0 SRCH base="" scope=2 deref=0 filter="(uid=dab)"
slapd[14091]: conn=4230904 op=0 SRCH base="c=ru" scope=2 deref=0
filter="(uid=dab)"
related bug&commit:
https://bugs.php.net/bug.php?id=77958
https://github.com/php/php-src/commit/5d2fe48785b6d24102ff53e78631cba7f2aefbef
### PHP Version
PHP 8.0.12
### Operating System
gentoo