[php-src] Issue #21262: ldap_modify: no way to unset single valued attribute any more
[email protected] (ralfbecker)
| Newsgroups | php.bugs |
|---|---|
| Message-ID | <IxW03RHhJ4dvxrRSTV6d9mcJUXcCfoWB0OjevWVMGWY@main.internal.php.net> |
Issue: https://github.com/php/php-src/issues/21262
Author: ralfbecker
### Description
The following code:
```php
<?php
$ds = ldap_bind(...);
$dn = '....';
$entry = ['url' => []]))
try {
if (ldap_modify($ds, $dn, $entry)) {
echo "success";
}
}
catch (\ValueError $e) {
echo $e->getMessage();
```
Resulted in this output:
```
ldap_modify(): Argument #3 ($entry) attribute "url" must be a non-empty list of attribute values
```
But I expected this output instead:
```
success
```
Using an empty array is the documented way to unset both single- and multi-valued attributes.
Trying NULL for single-valued attributes also gives a php-side validation error, so this is also not working.
It was nice to have a way to unset attributes without knowing if they are single- or multi-values, but I could also live with two separate ways, thought there should be at least one (documented) way to unset single-valued attributes with ldap_modify too.
### PHP Version
```plain
PHP 8.5.3 (cli) (built: Feb 13 2026 15:52:21) (NTS)
Copyright (c) The PHP Group
Built by Debian
Zend Engine v4.5.3, Copyright (c) Zend Technologies
with Xdebug v3.5.0, Copyright (c) 2002-2025, by Derick Rethans
with Zend OPcache v8.5.3, Copyright (c), by Zend Technologies
```
### Operating System
Ubuntu 24.04 in a Docker container