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) 79int(0) 80bool(true) 81int(0) 82bool(true) 83string(14) "dc=test,dc=com" 84===DONE=== 85