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  [0]=>
81  array(2) {
82    ["oid"]=>
83    string(15) "1.2.752.58.10.1"
84    ["iscritical"]=>
85    bool(true)
86  }
87  [1]=>
88  array(3) {
89    ["oid"]=>
90    string(15) "1.2.752.58.1.10"
91    ["iscritical"]=>
92    bool(false)
93    ["value"]=>
94    string(5) "magic"
95  }
96}
97bool(true)
98array(2) {
99  [0]=>
100  array(2) {
101    ["oid"]=>
102    string(15) "1.2.752.58.10.1"
103    ["iscritical"]=>
104    bool(true)
105  }
106  [1]=>
107  array(3) {
108    ["oid"]=>
109    string(15) "1.2.752.58.1.10"
110    ["iscritical"]=>
111    bool(false)
112    ["value"]=>
113    string(5) "magic"
114  }
115}
116bool(true)
117string(14) "dc=test,dc=com"
118===DONE===
119