1--TEST-- 2ldap_set_option() - More ldap_set_option() operations 3--CREDITS-- 4Patrick Allaert <patrickallaert@php.net> 5# Belgian PHP Testfest 2009 6--EXTENSIONS-- 7ldap 8--FILE-- 9<?php 10require "connect.inc"; 11 12$link = ldap_connect($uri); 13$option = null; 14 15$controls = array( 16 array("oid" => "1.2.752.58.10.1", "iscritical" => true), 17 array("oid" => "1.2.752.58.1.10", "value" => "magic"), 18); 19 20var_dump(ldap_set_option($link, LDAP_OPT_DEREF, LDAP_DEREF_ALWAYS)); 21ldap_get_option($link, LDAP_OPT_DEREF, $option); 22var_dump( 23 $option === LDAP_DEREF_ALWAYS, 24 ldap_set_option($link, LDAP_OPT_SIZELIMIT, 123) 25); 26ldap_get_option($link, LDAP_OPT_SIZELIMIT, $option); 27var_dump( 28 $option, 29 ldap_set_option($link, LDAP_OPT_TIMELIMIT, 33) 30); 31ldap_get_option($link, LDAP_OPT_TIMELIMIT, $option); 32var_dump( 33 $option, 34 ldap_set_option($link, LDAP_OPT_NETWORK_TIMEOUT, 44) 35); 36ldap_get_option($link, LDAP_OPT_NETWORK_TIMEOUT, $option); 37var_dump( 38 $option, 39 ldap_set_option($link, LDAP_OPT_REFERRALS, true) 40); 41ldap_get_option($link, LDAP_OPT_REFERRALS, $option); 42var_dump( 43 (bool) $option, 44 ldap_set_option($link, LDAP_OPT_RESTART, false) 45); 46ldap_get_option($link, LDAP_OPT_RESTART, $option); 47var_dump( 48 (bool) $option, 49 ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, $controls) 50); 51ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $option); 52var_dump( 53 $option, 54 ldap_set_option($link, LDAP_OPT_CLIENT_CONTROLS, $controls) 55); 56ldap_get_option($link, LDAP_OPT_CLIENT_CONTROLS, $option); 57var_dump( 58 $option, 59 ldap_set_option($link, LDAP_OPT_MATCHED_DN, "dc=test,dc=com") 60); 61ldap_get_option($link, LDAP_OPT_MATCHED_DN, $option); 62var_dump($option); 63?> 64--EXPECT-- 65bool(true) 66bool(true) 67bool(true) 68int(123) 69bool(true) 70int(33) 71bool(true) 72int(44) 73bool(true) 74bool(true) 75bool(true) 76bool(false) 77bool(true) 78array(2) { 79 ["1.2.752.58.10.1"]=> 80 array(3) { 81 ["oid"]=> 82 string(15) "1.2.752.58.10.1" 83 ["iscritical"]=> 84 bool(true) 85 ["value"]=> 86 NULL 87 } 88 ["1.2.752.58.1.10"]=> 89 array(3) { 90 ["oid"]=> 91 string(15) "1.2.752.58.1.10" 92 ["iscritical"]=> 93 bool(false) 94 ["value"]=> 95 string(5) "magic" 96 } 97} 98bool(true) 99array(2) { 100 ["1.2.752.58.10.1"]=> 101 array(3) { 102 ["oid"]=> 103 string(15) "1.2.752.58.10.1" 104 ["iscritical"]=> 105 bool(true) 106 ["value"]=> 107 NULL 108 } 109 ["1.2.752.58.1.10"]=> 110 array(3) { 111 ["oid"]=> 112 string(15) "1.2.752.58.1.10" 113 ["iscritical"]=> 114 bool(false) 115 ["value"]=> 116 string(5) "magic" 117 } 118} 119bool(true) 120string(14) "dc=test,dc=com" 121