php / php/php-src

ldap_search not working with base=NULL after php7.1

未关闭
#7,998 8 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Bug Extension: ldap Status: Needs Triage
主要语言
C
星标
40.4k
派生
8.2k
平均合并
2 天 13 小时
30 天内合并 PR
96

描述

Description

The following code:

<?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:
version <=php7.1
slapd[14091]: conn=4230904 op=0 SRCH base="c=ru" scope=2 deref=0 filter="(uid=dab)"
version >php7.1
slapd[14091]: conn=4230791 op=0 SRCH base="" 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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 ldap_search 入口点开始,将复现中显示的行为与链接的 bug 以及提交 5d2fe48785b6d24102ff53e78631cba7f2aefbef 进行比较。使用所述 LDAP 配置运行提供的 PHP 脚本并检查 slapd.log;当 NULL base 使用已配置的 BASE 且搜索返回预期条目时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
php
领域
backend
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。