1--TEST-- 2ldap_modify_batch() - Basic batch modify operation 3--CREDITS-- 4Patrick Allaert <patrickallaert@php.net> 5Ondřej Hošek <ondra.hosek@gmail.com> 6--SKIPIF-- 7<?php require_once('skipif.inc'); ?> 8<?php require_once('skipifbindfailure.inc'); ?> 9--FILE-- 10<?php 11require "connect.inc"; 12 13$link = ldap_connect_and_bind($host, $port, $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 "+1 555 5551717" 22 ) 23 ), 24 array( 25 "attrib" => "sn", 26 "modtype" => LDAP_MODIFY_BATCH_REPLACE, 27 "values" => array("Brown-Smith") 28 ), 29 array( 30 "attrib" => "description", 31 "modtype" => LDAP_MODIFY_BATCH_REMOVE_ALL 32 ) 33); 34 35var_dump( 36 ldap_modify_batch($link, "cn=userA,$base", $mods), 37 ldap_get_entries($link, ldap_search($link, "$base", "(sn=Brown-Smith)")) 38); 39?> 40--CLEAN-- 41<?php 42require "connect.inc"; 43 44$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); 45 46remove_dummy_data($link, $base); 47?> 48--EXPECTF-- 49bool(true) 50array(2) { 51 ["count"]=> 52 int(1) 53 [0]=> 54 array(12) { 55 ["objectclass"]=> 56 array(2) { 57 ["count"]=> 58 int(1) 59 [0]=> 60 string(6) "person" 61 } 62 [0]=> 63 string(11) "objectclass" 64 ["cn"]=> 65 array(2) { 66 ["count"]=> 67 int(1) 68 [0]=> 69 string(5) "userA" 70 } 71 [1]=> 72 string(2) "cn" 73 ["userpassword"]=> 74 array(2) { 75 ["count"]=> 76 int(1) 77 [0]=> 78 string(%d) "%s" 79 } 80 [2]=> 81 string(12) "userpassword" 82 ["telephonenumber"]=> 83 array(3) { 84 ["count"]=> 85 int(2) 86 [0]=> 87 string(14) "xx-xx-xx-xx-xx" 88 [1]=> 89 string(14) "+1 555 5551717" 90 } 91 [3]=> 92 string(15) "telephonenumber" 93 ["sn"]=> 94 array(2) { 95 ["count"]=> 96 int(1) 97 [0]=> 98 string(11) "Brown-Smith" 99 } 100 [4]=> 101 string(2) "sn" 102 ["count"]=> 103 int(5) 104 ["dn"]=> 105 string(%d) "cn=userA,%s" 106 } 107} 108