xref: /PHP-8.0/ext/ldap/tests/ldap_delete_ext.phpt (revision f8d79582)
1--TEST--
2ldap_delete_ext() - Delete operation with controls
3--CREDITS--
4Côme Chilliet <mcmic@php.net>
5--SKIPIF--
6<?php require_once('skipif.inc'); ?>
7<?php require_once('skipifbindfailure.inc'); ?>
8<?php
9require_once('skipifcontrol.inc');
10skipifunsupportedcontrol(LDAP_CONTROL_PRE_READ);
11?>
12--FILE--
13<?php
14require "connect.inc";
15
16$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
17ldap_add($link, "dc=my-domain,$base", array(
18    "objectClass"	=> array(
19        "top",
20        "dcObject",
21        "organization"),
22    "dc"			=> "my-domain",
23    "o"				=> "my-domain",
24));
25
26var_dump(
27    $result = ldap_delete_ext($link, "dc=my-domain,$base",
28        [['oid' => LDAP_CONTROL_PRE_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['dc', 'o']]]]
29    ),
30    ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls),
31    $errcode,
32    $errmsg,
33    $ctrls[LDAP_CONTROL_PRE_READ],
34    @ldap_search($link, "dc=my-domain,$base", "(o=my-domain)")
35);
36?>
37--CLEAN--
38<?php
39require "connect.inc";
40
41$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version);
42
43ldap_delete($link, "dc=my-domain,$base");
44?>
45--EXPECTF--
46resource(%d) of type (ldap result)
47bool(true)
48int(0)
49string(0) ""
50array(2) {
51  ["oid"]=>
52  string(14) "1.3.6.1.1.13.1"
53  ["value"]=>
54  array(3) {
55    ["dn"]=>
56    string(%d) "dc=my-domain,%s"
57    ["dc"]=>
58    array(1) {
59      [0]=>
60      string(9) "my-domain"
61    }
62    ["o"]=>
63    array(1) {
64      [0]=>
65      string(9) "my-domain"
66    }
67  }
68}
69bool(false)
70