1--TEST-- 2Test External Authentication errors with oci_pconnect 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"); 7die("skip random CI timeouts caused by Oracle Instant Client, see https://github.com/php/php-src/pull/9524#issuecomment-1244409815"); 8?> 9--INI-- 10oci8.privileged_connect=1 11--FILE-- 12<?php 13 14echo "Test 1\n"; 15 16$c = oci_pconnect('/', 'notemtpy', 'anything', null, OCI_CRED_EXT); 17if (!$c) { 18 $m = oci_error(); 19 var_dump($m); 20} 21var_dump($c); 22 23echo "Test 2\n"; 24 25$c = oci_pconnect('notemtpy', 'notemtpy', 'anything', null, OCI_CRED_EXT); 26if (!$c) { 27 $m = oci_error(); 28 var_dump($m); 29} 30var_dump($c); 31 32echo "Test 3\n"; 33 34$c = oci_pconnect('notemtpy', '', 'anything', null, OCI_CRED_EXT); 35if (!$c) { 36 $m = oci_error(); 37 var_dump($m); 38} 39var_dump($c); 40 41echo "Test 4\n"; 42 43$c = oci_pconnect('a', 'b', 'c', null, OCI_SYSDBA+OCI_SYSOPER); 44if (!$c) { 45 $m = oci_error(); 46 var_dump($m); 47} 48var_dump($c); 49 50echo "Test 5\n"; 51 52$c = oci_pconnect('a', 'b', 'c', null, OCI_SYSDBA+OCI_SYSOPER+OCI_CRED_EXT); 53if (!$c) { 54 $m = oci_error(); 55 var_dump($m); 56} 57var_dump($c); 58 59echo "Test 6\n"; 60 61$c = oci_pconnect('', '', 'anything', null, OCI_CRED_EXT); 62if (!$c) { 63 $m = oci_error(); 64 var_dump($m); 65} 66var_dump($c); 67 68echo "Test 7\n"; 69 70$c = oci_pconnect('/', '', 'anything', null, OCI_CRED_EXT); 71if (!$c) { 72 $m = oci_error(); 73 var_dump($m); 74} 75var_dump($c); 76 77echo "Test 8\n"; 78 79$c = oci_pconnect('/', null, 'anything', null, OCI_CRED_EXT); 80if (!$c) { 81 $m = oci_error(); 82 var_dump($m); 83} 84var_dump($c); 85 86echo "Test 9\n"; 87 88$c = oci_pconnect('/', '', 'd', null, OCI_SYSDBA+OCI_CRED_EXT); 89if (!$c) { 90 $m = oci_error(); 91 var_dump($m); 92} 93var_dump($c); 94 95echo "Test 10\n"; 96 97$c = oci_pconnect('/', '', 'd', null, OCI_SYSOPER+OCI_CRED_EXT); 98if (!$c) { 99 $m = oci_error(); 100 var_dump($m); 101} 102var_dump($c); 103 104 105?> 106--EXPECTF-- 107Test 1 108 109Warning: oci_pconnect(): OCI_CRED_EXT can only be used with a username of "/" and a NULL password in %s on line %d 110bool(false) 111bool(false) 112Test 2 113 114Warning: oci_pconnect(): 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 3 118 119Warning: oci_pconnect(): 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 4 123 124Warning: oci_pconnect(): OCI_SYSDBA and OCI_SYSOPER cannot be used together in %s on line %d 125bool(false) 126bool(false) 127Test 5 128 129Warning: oci_pconnect(): OCI_SYSDBA and OCI_SYSOPER cannot be used together in %s on line %d 130bool(false) 131bool(false) 132Test 6 133 134Warning: oci_pconnect(): OCI_CRED_EXT can only be used with a username of "/" and a NULL password in %s on line %d 135bool(false) 136bool(false) 137Test 7 138 139Warning: oci_pconnect(): ORA-12154: %s in %s on line %d 140array(4) { 141 ["code"]=> 142 int(12154) 143 ["message"]=> 144 string(%d) "ORA-12154: %s" 145 ["offset"]=> 146 int(0) 147 ["sqltext"]=> 148 string(0) "" 149} 150bool(false) 151Test 8 152 153Warning: oci_pconnect(): ORA-12154: %s in %s on line %d 154array(4) { 155 ["code"]=> 156 int(12154) 157 ["message"]=> 158 string(%d) "ORA-12154: %s" 159 ["offset"]=> 160 int(0) 161 ["sqltext"]=> 162 string(0) "" 163} 164bool(false) 165Test 9 166 167Warning: oci_pconnect(): ORA-%d: TNS:%s in %s on line %d 168array(4) { 169 ["code"]=> 170 int(%d) 171 ["message"]=> 172 string(%d) "ORA-%d: %s" 173 ["offset"]=> 174 int(0) 175 ["sqltext"]=> 176 string(0) "" 177} 178bool(false) 179Test 10 180 181Warning: oci_pconnect(): ORA-%d: TNS:%s in %s on line %d 182array(4) { 183 ["code"]=> 184 int(%d) 185 ["message"]=> 186 string(%d) "ORA-%d: %s" 187 ["offset"]=> 188 int(0) 189 ["sqltext"]=> 190 string(0) "" 191} 192bool(false) 193