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