1--TEST-- 2ldap_add_ext() - Add 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_POST_READ); 11?> 12--FILE-- 13<?php 14require "connect.inc"; 15 16$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); 17 18var_dump( 19 $result = ldap_add_ext($link, "o=test_ldap_add_ext,$base", array( 20 "objectClass" => array( 21 "top", 22 "organization"), 23 "o" => "test_ldap_add_ext", 24 ), [['oid' => LDAP_CONTROL_POST_READ, 'iscritical' => TRUE, 'value' => ['attrs' => ['o']]]]), 25 ldap_parse_result($link, $result, $errcode, $matcheddn, $errmsg, $referrals, $ctrls), 26 $errcode, 27 $errmsg, 28 $ctrls[LDAP_CONTROL_POST_READ], 29 ldap_get_entries( 30 $link, 31 ldap_search($link, "$base", "(o=test_ldap_add_ext)") 32 ) 33); 34?> 35--CLEAN-- 36<?php 37require "connect.inc"; 38 39$link = ldap_connect_and_bind($host, $port, $user, $passwd, $protocol_version); 40 41ldap_delete($link, "o=test_ldap_add_ext,$base"); 42?> 43--EXPECTF-- 44resource(%d) of type (ldap result) 45bool(true) 46int(0) 47string(0) "" 48array(2) { 49 ["oid"]=> 50 string(14) "1.3.6.1.1.13.2" 51 ["value"]=> 52 array(2) { 53 ["dn"]=> 54 string(%d) "o=test_ldap_add_ext,%s" 55 ["o"]=> 56 array(1) { 57 [0]=> 58 string(17) "test_ldap_add_ext" 59 } 60 } 61} 62array(2) { 63 ["count"]=> 64 int(1) 65 [0]=> 66 array(6) { 67 ["objectclass"]=> 68 array(3) { 69 ["count"]=> 70 int(2) 71 [0]=> 72 string(3) "top" 73 [1]=> 74 string(12) "organization" 75 } 76 [0]=> 77 string(11) "objectclass" 78 ["o"]=> 79 array(2) { 80 ["count"]=> 81 int(1) 82 [0]=> 83 string(17) "test_ldap_add_ext" 84 } 85 [1]=> 86 string(1) "o" 87 ["count"]=> 88 int(2) 89 ["dn"]=> 90 string(%d) "o=test_ldap_add_ext,%s" 91 } 92} 93