Skip to content

Segfault in ldap_list(), ldap_read(), and ldap_search() when LDAPs array is not a list #16101

Closed
@Girgias

Description

@Girgias

Description

The following code:

<?php

/* We are assuming 3333 is not connectable */
$ldap = ldap_connect('ldap://127.0.0.1:3333');
$valid_dn = "cn=userA,something";
$valid_filter = "";

$ldaps_dict = [
    "hello"  => $ldap,
    "world"  => $ldap,
];
try {
    var_dump(ldap_list($ldaps_dict, $valid_dn, $valid_filter));
} catch (Throwable $e) {
    echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}

Resulted in this output:

php: /home/girgias/Dev/PHP-8.2/Zend/zend_hash.c:2626: zend_hash_internal_pointer_reset_ex: Assertion `(&ht->nInternalPointer != pos || zend_gc_refcount(&(ht)->gc) == 1) || ((ht)->u.flags & (1<<6))' failed.

Termsig=6

But I expected this output instead:

ValueError: ldap_list(): Argument #1 ($ldap) must be a list

PHP Version

PHP 8.2

Operating System

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions