Skip to content

ldap_modify: no way to unset single valued attribute any more #21262

@ralfbecker

Description

@ralfbecker

Description

The following code:

<?php
$ds = ldap_bind(...);
$dn = '....';
$entry = ['personalTitle' => []]))
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

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions