|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #64317 [PATCH] add ldap_modify_batch function
Submitted: 2013-02-27 23:35 UTC Modified: 2015-06-10 11:51 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: ondra dot hosek at gmail dot com Assigned:
Status: Closed Package: LDAP related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: ondra dot hosek at gmail dot com
New email:
PHP Version: OS:


 [2013-02-27 23:35 UTC] ondra dot hosek at gmail dot com

motivated by the impossibility of performing an Active Directory password change (not reset), which requires a simultaneous REMOVE and ADD operation on the unicodePwd attribute of a user, I have set out to write a function named ldap_modify_batch that would allow this.

The test script demonstrates the API of this function. I'll admit that this API (especially the array-of-arrays-of-arrays part) is a bit weird and I'll gladly accept tips on how to streamline it. There is also a (more complete but also more contrived) example in the function body itself.

Test script:

function adifyPw($pw)
	$quoted = '"' . $pw . '"';
	$utf16d = iconv("UTF-8", "UTF-16LE", $quoted);
	return $utf16d;

$curPwd = adifyPw("Tr0ub4dor&3");
$newPwd = adifyPw("correct horse battery staple");

$conn = ldap_connect("ldaps://");
ldap_bind($conn, "", "Tr0ub4dor&3");
$mods = array(
		"attrib" => "unicodePwd",
		"values" => array($curPwd)
		"attrib" => "unicodePwd",
		"modtype" => LDAP_MODIFY_BATCH_ADD,
		"values" => array($newPwd)
ldap_modify_batch($conn, "cn=John Smith,ou=Accounting,dc=ad,dc=example,dc=com", $mods);



ldap_modify_batch.patch (last revision 2013-02-27 23:35 UTC by ondra dot hosek at gmail dot com)

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-06-10 11:05 UTC] martin dot keckeis1 at gmail dot com
This was already added in PHP 5.4:
 [2015-06-10 11:51 UTC] ondra dot hosek at gmail dot com
-Status: Open +Status: Closed
 [2015-06-10 11:51 UTC] ondra dot hosek at gmail dot com
Good point. I discussed this on the mailing list and forgot all about this bug. Closing.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jul 19 14:01:30 2024 UTC