1--TEST-- 2ldap_mod_ext() - Modify operations with controls 3--CREDITS-- 4Patrick Allaert <patrickallaert@php.net> 5# Belgian PHP Testfest 2009 6--SKIPIF-- 7<?php require_once('skipif.inc'); ?> 8<?php require_once('skipifbindfailure.inc'); ?> 9<?php 10require_once('skipifcontrol.inc'); 11skipifunsupportedcontrol(LDAP_CONTROL_PRE_READ); 12skipifunsupportedcontrol(LDAP_CONTROL_POST_READ); 13?> 14--FILE-- 15<?php 16require "connect.inc"; 17 18$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); 19insert_dummy_data($link, $base); 20 21$entry = array( 22 "description" => "Domain description", 23); 24 25var_dump( 26 $result = ldap_mod_add_ext($link, "o=test,$base", $entry, 27 [ 28 ['oid' => LDAP_CONTROL_PRE_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['description']]], 29 ['oid' => LDAP_CONTROL_POST_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['description']]], 30 ] 31 ), 32 ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), 33 $errcode, 34 $errmsg, 35 $ctrls, 36 ldap_get_entries( 37 $link, 38 ldap_search($link, "o=test,$base", "(Description=Domain description)") 39 ), 40 $result = ldap_mod_del_ext($link, "o=test,$base", $entry, 41 [ 42 ['oid' => LDAP_CONTROL_PRE_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['description']]], 43 ['oid' => LDAP_CONTROL_POST_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['description']]], 44 ] 45 ), 46 ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), 47 $errcode, 48 $errmsg, 49 $ctrls, 50 ldap_get_entries( 51 $link, 52 ldap_search($link, "o=test,$base", "(Description=Domain description)") 53 ) 54); 55?> 56===DONE=== 57--CLEAN-- 58<?php 59require "connect.inc"; 60 61$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); 62 63remove_dummy_data($link, $base); 64?> 65--EXPECTF-- 66resource(%d) of type (ldap result) 67bool(true) 68int(0) 69string(0) "" 70array(2) { 71 ["1.3.6.1.1.13.1"]=> 72 array(2) { 73 ["oid"]=> 74 string(14) "1.3.6.1.1.13.1" 75 ["value"]=> 76 array(1) { 77 ["dn"]=> 78 string(%d) "o=test,%s" 79 } 80 } 81 ["1.3.6.1.1.13.2"]=> 82 array(2) { 83 ["oid"]=> 84 string(14) "1.3.6.1.1.13.2" 85 ["value"]=> 86 array(2) { 87 ["dn"]=> 88 string(%d) "o=test,%s" 89 ["description"]=> 90 array(1) { 91 [0]=> 92 string(18) "Domain description" 93 } 94 } 95 } 96} 97array(2) { 98 ["count"]=> 99 int(1) 100 [0]=> 101 array(8) { 102 ["objectclass"]=> 103 array(3) { 104 ["count"]=> 105 int(2) 106 [0]=> 107 string(3) "top" 108 [1]=> 109 string(12) "organization" 110 } 111 [0]=> 112 string(11) "objectclass" 113 ["o"]=> 114 array(2) { 115 ["count"]=> 116 int(1) 117 [0]=> 118 string(4) "test" 119 } 120 [1]=> 121 string(1) "o" 122 ["description"]=> 123 array(2) { 124 ["count"]=> 125 int(1) 126 [0]=> 127 string(18) "Domain description" 128 } 129 [2]=> 130 string(11) "description" 131 ["count"]=> 132 int(3) 133 ["dn"]=> 134 string(%d) "o=test,%s" 135 } 136} 137resource(%d) of type (ldap result) 138bool(true) 139int(0) 140string(0) "" 141array(2) { 142 ["1.3.6.1.1.13.1"]=> 143 array(2) { 144 ["oid"]=> 145 string(14) "1.3.6.1.1.13.1" 146 ["value"]=> 147 array(2) { 148 ["dn"]=> 149 string(%d) "o=test,%s" 150 ["description"]=> 151 array(1) { 152 [0]=> 153 string(18) "Domain description" 154 } 155 } 156 } 157 ["1.3.6.1.1.13.2"]=> 158 array(2) { 159 ["oid"]=> 160 string(14) "1.3.6.1.1.13.2" 161 ["value"]=> 162 array(1) { 163 ["dn"]=> 164 string(%d) "o=test,%s" 165 } 166 } 167} 168array(1) { 169 ["count"]=> 170 int(0) 171} 172===DONE=== 173