1--TEST--
2ldap_get_option() - More ldap_get_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
20ldap_set_option($link, LDAP_OPT_DEREF, LDAP_DEREF_NEVER);
21ldap_set_option($link, LDAP_OPT_SIZELIMIT, 123);
22ldap_set_option($link, LDAP_OPT_TIMELIMIT, 33);
23ldap_set_option($link, LDAP_OPT_NETWORK_TIMEOUT, 44);
24ldap_set_option($link, LDAP_OPT_TIMEOUT, 55);
25ldap_set_option($link, LDAP_OPT_REFERRALS, false);
26ldap_set_option($link, LDAP_OPT_SERVER_CONTROLS, $controls);
27ldap_set_option($link, LDAP_OPT_CLIENT_CONTROLS, $controls);
28ldap_set_option($link, LDAP_OPT_RESTART, false);
29
30var_dump(
31    ldap_get_option($link, LDAP_OPT_DEREF, $option),
32    $option,
33    ldap_get_option($link, LDAP_OPT_SIZELIMIT, $option),
34    $option,
35    ldap_get_option($link, LDAP_OPT_TIMELIMIT, $option),
36    $option,
37    ldap_get_option($link, LDAP_OPT_NETWORK_TIMEOUT, $option),
38    $option,
39    ldap_get_option($link, LDAP_OPT_TIMEOUT, $option),
40    $option,
41    ldap_get_option($link, LDAP_OPT_REFERRALS, $option),
42    $option,
43    ldap_get_option($link, LDAP_OPT_RESTART, $option),
44    $option,
45    ldap_get_option($link, LDAP_OPT_SERVER_CONTROLS, $option),
46    $option,
47    ldap_get_option($link, LDAP_OPT_CLIENT_CONTROLS, $option),
48    $option
49);
50?>
51--EXPECT--
52bool(true)
53int(0)
54bool(true)
55int(123)
56bool(true)
57int(33)
58bool(true)
59int(44)
60bool(true)
61int(55)
62bool(true)
63int(0)
64bool(true)
65int(0)
66bool(true)
67array(2) {
68  ["1.2.752.58.10.1"]=>
69  array(3) {
70    ["oid"]=>
71    string(15) "1.2.752.58.10.1"
72    ["iscritical"]=>
73    bool(true)
74    ["value"]=>
75    NULL
76  }
77  ["1.2.752.58.1.10"]=>
78  array(3) {
79    ["oid"]=>
80    string(15) "1.2.752.58.1.10"
81    ["iscritical"]=>
82    bool(false)
83    ["value"]=>
84    string(5) "magic"
85  }
86}
87bool(true)
88array(2) {
89  ["1.2.752.58.10.1"]=>
90  array(3) {
91    ["oid"]=>
92    string(15) "1.2.752.58.10.1"
93    ["iscritical"]=>
94    bool(true)
95    ["value"]=>
96    NULL
97  }
98  ["1.2.752.58.1.10"]=>
99  array(3) {
100    ["oid"]=>
101    string(15) "1.2.752.58.1.10"
102    ["iscritical"]=>
103    bool(false)
104    ["value"]=>
105    string(5) "magic"
106  }
107}
108