[pkg-php-pear] Bug#1129016: Bug#1129016: php-net-ldap2: Version 2.3.0-4 dep8 failures with PHP 8.5
Guilhem Moulin
guilhem at debian.org
Thu Apr 2 09:45:46 BST 2026
On Mon, 02 Mar 2026 at 15:29:26 -0300, Renan Rodrigo wrote:
> So passing null means we are not requesting any specific attributes, and
> passing an empty array should work the same, right?
> I tested it with just `[]` and it passed.
Tried it now (with PHP8.4.16 from Debian sid). The empty array appears
to needlessly return all user attributes, so I changed [0] the patch to
use `['1.1']` instead.
With PHP8.4 `['1.1']` works like `[null]` (but the latter is
undocumented and ceases to work with PHP8.5). AFAICT ldap_search(3) is
unclear how an empty attribute array is treated, but is clear [1] that
`{LDAP_NO_ATTRS, NULL}` should be used to avoid fetching any attribute.
--
Guilhem.
[0] https://salsa.debian.org/php-team/pear/php-net-ldap2/-/commit/9b909f5a6a7c0bdad04f11c8ae758990c89d8ca4
[1] https://manpages.debian.org/unstable/libldap-dev/ldap_search_ext.3.en.html#DESCRIPTION
-------------- next part --------------
<?php
ldap_set_option(null, LDAP_OPT_DEBUG_LEVEL, -1);
$ds = ldap_connect('ldapi://');
$attrs = [];
$result = ldap_search($ds, 'dc=nodomain', '(objectClass=*)', $attrs, 0, 0);
if (@ldap_count_entries($ds, $result)) {
$entry = @ldap_first_entry($ds, $result);
$dn = @ldap_get_dn($ds, $entry);
echo("dn: " . $dn . "\n");
$vs = @ldap_get_values($ds, $entry, 'objectClass');
if (is_array($vs)) {
foreach ($vs as $v) {
echo("objectClass: " . $v . "\n");
}
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-php-pear/attachments/20260402/57e0a3da/attachment.sig>
More information about the pkg-php-pear
mailing list