1--TEST-- 2DRCP: privileged connect 3--SKIPIF-- 4<?php 5if (!extension_loaded('oci8')) die("skip no oci8 extension"); 6require(dirname(__FILE__)."/details.inc"); 7if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user"); 8ob_start(); 9phpinfo(INFO_MODULES); 10$phpinfo = ob_get_clean(); 11if (preg_match('/Compile-time ORACLE_HOME/', $phpinfo) !== 1) { 12 // Assume building PHP with an ORACLE_HOME means the tested DB is on the same machine as PHP 13 die("skip this test is unlikely to work with a remote database - unless an Oracle password file has been created"); 14} 15?> 16--INI-- 17oci8.privileged_connect=1 18--FILE-- 19<?php 20 21// Connecting as SYSDBA or SYSOPER through DRCP will give ORA-1031 22 23require dirname(__FILE__)."/details.inc"; 24var_dump(oci_connect($user,$password,$dbase,false,OCI_SYSDBA)); 25var_dump(oci_connect($user,$password,$dbase,false,OCI_SYSOPER)); 26var_dump(oci_new_connect($user,$password,$dbase,false,OCI_SYSDBA)); 27var_dump(oci_new_connect($user,$password,$dbase,false,OCI_SYSOPER)); 28var_dump(oci_pconnect($user,$password,$dbase,false,OCI_SYSDBA)); 29var_dump(oci_pconnect($user,$password,$dbase,false,OCI_SYSOPER)); 30 31echo "Done\n"; 32 33?> 34--EXPECTF-- 35Warning: oci_connect(): ORA-01031: %s in %s on line %d 36bool(false) 37 38Warning: oci_connect(): ORA-01031: %s in %s on line %d 39bool(false) 40 41Warning: oci_new_connect(): ORA-01031: %s in %s on line %d 42bool(false) 43 44Warning: oci_new_connect(): ORA-01031: %s in %s on line %d 45bool(false) 46 47Warning: oci_pconnect(): ORA-01031: %s in %s on line %d 48bool(false) 49 50Warning: oci_pconnect(): ORA-01031: %s in %s on line %d 51bool(false) 52Done 53 54