xref: /PHP-8.4/ext/ldap/tests/bug77958.phpt (revision 69a8b63e)
1--TEST--
2ldap_modify_batch() - bug 77958 - values in ldap_modify_batch must be "string"
3--CREDITS--
4Côme Chilliet <mcmic@php.net>
5--EXTENSIONS--
6ldap
7--SKIPIF--
8<?php require_once('skipifbindfailure.inc'); ?>
9--FILE--
10<?php
11require "connect.inc";
12
13$link = ldap_connect_and_bind($uri, $user, $passwd, $protocol_version);
14insert_dummy_data($link, $base);
15
16$mods = array(
17    array(
18        "attrib"	=> "telephoneNumber",
19        "modtype"	=> LDAP_MODIFY_BATCH_ADD,
20        "values"	=> array(
21            123456
22        )
23    ),
24    array(
25        "attrib"	=> "description",
26        "modtype"	=> LDAP_MODIFY_BATCH_REMOVE_ALL
27    )
28);
29
30var_dump(
31    ldap_modify_batch($link, "cn=userA,$base", $mods),
32    $entry = ldap_first_entry($link, ldap_read($link, "cn=userA,$base", "(telephoneNumber=*)")),
33    ldap_get_values($link, $entry, "telephoneNumber")
34);
35?>
36--CLEAN--
37<?php
38require "connect.inc";
39
40$link = ldap_connect_and_bind($uri, $user, $passwd, $protocol_version);
41
42remove_dummy_data($link, $base);
43?>
44--EXPECTF--
45bool(true)
46object(LDAP\ResultEntry)#%d (0) {
47}
48array(3) {
49  [0]=>
50  string(14) "xx-xx-xx-xx-xx"
51  [1]=>
52  string(6) "123456"
53  ["count"]=>
54  int(2)
55}
56