1--TEST-- 2ldap_set_option() - More ldap_set_option() operations 3--CREDITS-- 4Patrick Allaert <patrickallaert@php.net> 5# Belgian PHP Testfest 2009 6--SKIPIF-- 7<?php require_once('skipif.inc'); ?> 8--FILE-- 9<?php 10require "connect.inc"; 11 12$link = ldap_connect($host, $port); 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===DONE=== 65--EXPECT-- 66bool(true) 67bool(true) 68bool(true) 69int(123) 70bool(true) 71int(33) 72bool(true) 73int(44) 74bool(true) 75bool(true) 76bool(true) 77bool(false) 78bool(true) 79array(2) { 80 ["1.2.752.58.10.1"]=> 81 array(3) { 82 ["oid"]=> 83 string(15) "1.2.752.58.10.1" 84 ["iscritical"]=> 85 bool(true) 86 ["value"]=> 87 NULL 88 } 89 ["1.2.752.58.1.10"]=> 90 array(3) { 91 ["oid"]=> 92 string(15) "1.2.752.58.1.10" 93 ["iscritical"]=> 94 bool(false) 95 ["value"]=> 96 string(5) "magic" 97 } 98} 99bool(true) 100array(2) { 101 ["1.2.752.58.10.1"]=> 102 array(3) { 103 ["oid"]=> 104 string(15) "1.2.752.58.10.1" 105 ["iscritical"]=> 106 bool(true) 107 ["value"]=> 108 NULL 109 } 110 ["1.2.752.58.1.10"]=> 111 array(3) { 112 ["oid"]=> 113 string(15) "1.2.752.58.1.10" 114 ["iscritical"]=> 115 bool(false) 116 ["value"]=> 117 string(5) "magic" 118 } 119} 120bool(true) 121string(14) "dc=test,dc=com" 122===DONE=== 123