1--TEST-- 2DRCP: privileged connect 3--EXTENSIONS-- 4oci8 5--SKIPIF-- 6<?php 7require(__DIR__."/connect.inc"); 8if (!$test_drcp) die("skip requires DRCP connection"); 9// Looked for :pooled in EZ connect string 10if (strpos($dbase, "/") !== false && stripos($dbase, ":pooled") === false) 11 die('skip DRCP test requires a DRCP pooled server connection'); 12if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user"); 13ob_start(); 14phpinfo(INFO_MODULES); 15$phpinfo = ob_get_clean(); 16if (preg_match('/Compile-time ORACLE_HOME/', $phpinfo) !== 1) { 17 // Assume building PHP with an ORACLE_HOME means the tested DB is on the same machine as PHP 18 die("skip this test is unlikely to work with a remote database - unless an Oracle password file has been created"); 19} 20 21preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches_sv); 22// This test in Oracle 12c needs a non-CDB or the root container 23if (isset($matches_sv[0]) && $matches_sv[1] >= 12) { 24 $s = oci_parse($c, "select nvl(sys_context('userenv', 'con_name'), 'notacdb') as dbtype from dual"); 25 $r = @oci_execute($s); 26 if (!$r) 27 die('skip could not identify container type'); 28 $r = oci_fetch_array($s); 29 if ($r['DBTYPE'] !== 'CDB$ROOT') 30 die('skip cannot run test using a PDB'); 31} 32?> 33--INI-- 34oci8.privileged_connect=1 35--FILE-- 36<?php 37 38// Connecting as SYSDBA or SYSOPER through DRCP will give ORA-1031 39 40require __DIR__."/details.inc"; 41var_dump(oci_connect($user,$password,$dbase,false,OCI_SYSDBA)); 42var_dump(oci_connect($user,$password,$dbase,false,OCI_SYSOPER)); 43var_dump(oci_new_connect($user,$password,$dbase,false,OCI_SYSDBA)); 44var_dump(oci_new_connect($user,$password,$dbase,false,OCI_SYSOPER)); 45var_dump(oci_pconnect($user,$password,$dbase,false,OCI_SYSDBA)); 46var_dump(oci_pconnect($user,$password,$dbase,false,OCI_SYSOPER)); 47 48echo "Done\n"; 49 50?> 51--EXPECTF-- 52Warning: oci_connect(): ORA-01031: %s in %s on line %d 53bool(false) 54 55Warning: oci_connect(): ORA-01031: %s in %s on line %d 56bool(false) 57 58Warning: oci_new_connect(): ORA-01031: %s in %s on line %d 59bool(false) 60 61Warning: oci_new_connect(): ORA-01031: %s in %s on line %d 62bool(false) 63 64Warning: oci_pconnect(): ORA-01031: %s in %s on line %d 65bool(false) 66 67Warning: oci_pconnect(): ORA-01031: %s in %s on line %d 68bool(false) 69Done 70