xref: /PHP-7.0/ext/oci8/tests/extauth_01.phpt (revision a96f99e3)
1--TEST--
2Test External Authentication errors with oci_connect
3--SKIPIF--
4<?php
5if (!extension_loaded('oci8')) die ("skip no oci8 extension");
6if (substr(PHP_OS, 0, 3) == 'WIN') die("skip feature not available on Windows platforms");
7require(dirname(__FILE__).'/details.inc');
8if (getenv('SKIP_SLOW_TESTS')) die('skip slow tests excluded by request');
9?>
10--INI--
11oci8.privileged_connect=1
12--FILE--
13<?php
14
15// Run Test
16
17echo "Test 1\n";
18
19$c = oci_connect('/', 'notemtpy', 'anything', null, OCI_CRED_EXT);
20if (!$c) {
21	$m = oci_error();
22	var_dump($m);
23}
24var_dump($c);
25
26echo "Test 2\n";
27
28$c = oci_connect('notemtpy', 'notemtpy', 'anything', null, OCI_CRED_EXT);
29if (!$c) {
30	$m = oci_error();
31	var_dump($m);
32}
33var_dump($c);
34
35echo "Test 3\n";
36
37$c = oci_connect('notemtpy', '', 'anything', null, OCI_CRED_EXT);
38if (!$c) {
39	$m = oci_error();
40	var_dump($m);
41}
42var_dump($c);
43
44echo "Test 4\n";
45
46$c = oci_connect('a', 'b', 'c', null, OCI_SYSDBA+OCI_SYSOPER);
47if (!$c) {
48	$m = oci_error();
49	var_dump($m);
50}
51var_dump($c);
52
53echo "Test 5\n";
54
55$c = oci_connect('a', 'b', 'c', null, OCI_SYSDBA+OCI_SYSOPER+OCI_CRED_EXT);
56if (!$c) {
57	$m = oci_error();
58	var_dump($m);
59}
60var_dump($c);
61
62echo "Test 6\n";
63
64$c = oci_connect('', '', 'anything', null, OCI_CRED_EXT);
65if (!$c) {
66	$m = oci_error();
67	var_dump($m);
68}
69var_dump($c);
70
71echo "Test 7\n";
72
73$c = oci_connect('/', '', 'anything', null, OCI_CRED_EXT);
74if (!$c) {
75	$m = oci_error();
76	var_dump($m);
77}
78var_dump($c);
79
80echo "Test 8\n";
81
82$c = oci_connect('/', null, 'anything', null, OCI_CRED_EXT);
83if (!$c) {
84	$m = oci_error();
85	var_dump($m);
86}
87var_dump($c);
88
89echo "Test 9\n";
90
91$c = oci_connect('/', '', 'd', null, OCI_SYSDBA+OCI_CRED_EXT);
92if (!$c) {
93	$m = oci_error();
94	var_dump($m);
95}
96var_dump($c);
97
98echo "Test 10\n";
99
100$c = oci_connect('/', '', 'd', null, OCI_SYSOPER+OCI_CRED_EXT);
101if (!$c) {
102	$m = oci_error();
103	var_dump($m);
104}
105var_dump($c);
106
107
108?>
109===DONE===
110<?php exit(0); ?>
111--EXPECTF--
112Test 1
113
114Warning: oci_connect(): OCI_CRED_EXT can only be used with a username of "/" and a NULL password in %s on line %d
115bool(false)
116bool(false)
117Test 2
118
119Warning: oci_connect(): OCI_CRED_EXT can only be used with a username of "/" and a NULL password in %s on line %d
120bool(false)
121bool(false)
122Test 3
123
124Warning: oci_connect(): OCI_CRED_EXT can only be used with a username of "/" and a NULL password in %s on line %d
125bool(false)
126bool(false)
127Test 4
128
129Warning: oci_connect(): OCI_SYSDBA and OCI_SYSOPER cannot be used together in %s on line %d
130bool(false)
131bool(false)
132Test 5
133
134Warning: oci_connect(): OCI_SYSDBA and OCI_SYSOPER cannot be used together in %s on line %d
135bool(false)
136bool(false)
137Test 6
138
139Warning: oci_connect(): OCI_CRED_EXT can only be used with a username of "/" and a NULL password in %s on line %d
140bool(false)
141bool(false)
142Test 7
143
144Warning: oci_connect(): ORA-12154: %s in %s on line %d
145array(4) {
146  ["code"]=>
147  int(12154)
148  ["message"]=>
149  string(%d) "ORA-12154: %s"
150  ["offset"]=>
151  int(0)
152  ["sqltext"]=>
153  string(0) ""
154}
155bool(false)
156Test 8
157
158Warning: oci_connect(): ORA-12154: %s in %s on line %d
159array(4) {
160  ["code"]=>
161  int(12154)
162  ["message"]=>
163  string(%d) "ORA-12154: %s"
164  ["offset"]=>
165  int(0)
166  ["sqltext"]=>
167  string(0) ""
168}
169bool(false)
170Test 9
171
172Warning: oci_connect(): ORA-%d: TNS:%s in %s on line %d
173array(4) {
174  ["code"]=>
175  int(%d)
176  ["message"]=>
177  string(%d) "ORA-%d: %s"
178  ["offset"]=>
179  int(0)
180  ["sqltext"]=>
181  string(0) ""
182}
183bool(false)
184Test 10
185
186Warning: oci_connect(): ORA-%d: TNS:%s in %s on line %d
187array(4) {
188  ["code"]=>
189  int(%d)
190  ["message"]=>
191  string(%d) "ORA-%d: %s"
192  ["offset"]=>
193  int(0)
194  ["sqltext"]=>
195  string(0) ""
196}
197bool(false)
198===DONE===
199