php-src/ext/oci8/tests/drcp_privileged.phpt
Peter Kokot b746e69887 Sync leading and final newlines in *.phpt sections
This patch adds missing newlines, trims multiple redundant final
newlines into a single one, and trims redundant leading newlines in all
*.phpt sections.

According to POSIX, a line is a sequence of zero or more non-' <newline>'
characters plus a terminating '<newline>' character. [1] Files should
normally have at least one final newline character.

C89 [2] and later standards [3] mention a final newline:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character."

Although it is not mandatory for all files to have a final newline
fixed, a more consistent and homogeneous approach brings less of commit
differences issues and a better development experience in certain text
editors and IDEs.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
[2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2
[3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
2018-10-15 04:32:30 +02:00

69 lines
2.4 KiB
PHP

--TEST--
DRCP: privileged connect
--SKIPIF--
<?php
if (!extension_loaded('oci8')) die("skip no oci8 extension");
require(dirname(__FILE__)."/connect.inc");
if (!$test_drcp) die("skip requires DRCP connection");
// Looked for :pooled in EZ connect string
if (strpos($dbase, "/") !== false && stripos($dbase, ":pooled") === false)
die('skip DRCP test requires a DRCP pooled server connection');
if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user");
ob_start();
phpinfo(INFO_MODULES);
$phpinfo = ob_get_clean();
if (preg_match('/Compile-time ORACLE_HOME/', $phpinfo) !== 1) {
// Assume building PHP with an ORACLE_HOME means the tested DB is on the same machine as PHP
die("skip this test is unlikely to work with a remote database - unless an Oracle password file has been created");
}
preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches_sv);
// This test in Oracle 12c needs a non-CDB or the root container
if (isset($matches_sv[0]) && $matches_sv[1] >= 12) {
$s = oci_parse($c, "select nvl(sys_context('userenv', 'con_name'), 'notacdb') as dbtype from dual");
$r = @oci_execute($s);
if (!$r)
die('skip could not identify container type');
$r = oci_fetch_array($s);
if ($r['DBTYPE'] !== 'CDB$ROOT')
die('skip cannot run test using a PDB');
}
?>
--INI--
oci8.privileged_connect=1
--FILE--
<?php
// Connecting as SYSDBA or SYSOPER through DRCP will give ORA-1031
require dirname(__FILE__)."/details.inc";
var_dump(oci_connect($user,$password,$dbase,false,OCI_SYSDBA));
var_dump(oci_connect($user,$password,$dbase,false,OCI_SYSOPER));
var_dump(oci_new_connect($user,$password,$dbase,false,OCI_SYSDBA));
var_dump(oci_new_connect($user,$password,$dbase,false,OCI_SYSOPER));
var_dump(oci_pconnect($user,$password,$dbase,false,OCI_SYSDBA));
var_dump(oci_pconnect($user,$password,$dbase,false,OCI_SYSOPER));
echo "Done\n";
?>
--EXPECTF--
Warning: oci_connect(): ORA-01031: %s in %s on line %d
bool(false)
Warning: oci_connect(): ORA-01031: %s in %s on line %d
bool(false)
Warning: oci_new_connect(): ORA-01031: %s in %s on line %d
bool(false)
Warning: oci_new_connect(): ORA-01031: %s in %s on line %d
bool(false)
Warning: oci_pconnect(): ORA-01031: %s in %s on line %d
bool(false)
Warning: oci_pconnect(): ORA-01031: %s in %s on line %d
bool(false)
Done