xref: /PHP-7.1/ext/oci8/tests/password_new.phpt (revision 0d909f5b)
1--TEST--
2oci_password_change()
3--SKIPIF--
4<?php
5$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on thes
6require(dirname(__FILE__).'/connect.inc');
7if (empty($dbase)) die ("skip requires database connection string be set");
8if ($test_drcp) die("skip password change not supported in DRCP Mode");
9
10preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches_sv);
11preg_match('/([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/', oci_client_version(), $matches);
12if (!(isset($matches_sv[0]) && isset($matches[0])
13       && $matches_sv[1] == $matches[1]
14       && $matches_sv[2] == $matches[2]
15       && $matches_sv[3] == $matches[3]
16       && $matches_sv[4] == $matches[4])) {
17           // Avoid diffs due to cross version protocol changes (e.g. like 11.2.0.2-11.2.0.3) and bugs like Oracle bug: 6277160
18       	   die ("skip test only runs when database client libraries and database server are the same version");
19}
20
21// This test in Oracle 12c needs a non-CDB or the root container
22if (isset($matches_sv[0]) && $matches_sv[1] >= 12) {
23    $s = oci_parse($c, "select nvl(sys_context('userenv', 'con_name'), 'notacdb') as dbtype from dual");
24    $r = @oci_execute($s);
25    if (!$r)
26        die('skip could not identify container type');
27    $r = oci_fetch_array($s);
28    if ($r['DBTYPE'] !== 'CDB$ROOT')
29        die('skip cannot run test using a PDB');
30}
31?>
32--FILE--
33<?php
34
35require dirname(__FILE__)."/connect.inc";
36
37$new_password = "test";
38var_dump(oci_password_change($dbase, $user, $password, $new_password));
39var_dump($new_c = ocilogon($user,$new_password,$dbase));
40var_dump(oci_password_change($dbase, $user, $new_password, $password));
41
42
43echo "Done\n";
44
45?>
46--EXPECTF--
47resource(%d) of type (oci8 connection)
48resource(%d) of type (oci8 connection)
49resource(%d) of type (oci8 connection)
50Done
51