xref: /PHP-7.3/ext/oci8/tests/password_new.phpt (revision 7a9c20f3)
1--TEST--
2oci_password_change()
3--SKIPIF--
4<?php
5$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on thes
6require(dirname(__FILE__).'/skipif.inc');
7require(dirname(__FILE__).'/connect.inc');
8if (empty($dbase)) die ("skip requires database connection string be set");
9if ($test_drcp) die("skip password change not supported in DRCP Mode");
10
11preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches_sv);
12preg_match('/([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/', oci_client_version(), $matches);
13if (!(isset($matches_sv[0]) && isset($matches[0])
14       && $matches_sv[1] == $matches[1]
15       && $matches_sv[2] == $matches[2]
16       && $matches_sv[3] == $matches[3]
17       && $matches_sv[4] == $matches[4])) {
18           // 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
19       	   die ("skip test only runs when database client libraries and database server are the same version");
20}
21
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--FILE--
34<?php
35
36require dirname(__FILE__)."/connect.inc";
37
38$new_password = "test";
39var_dump(oci_password_change($dbase, $user, $password, $new_password));
40var_dump($new_c = ocilogon($user,$new_password,$dbase));
41var_dump(oci_password_change($dbase, $user, $new_password, $password));
42
43
44echo "Done\n";
45
46?>
47--EXPECTF--
48resource(%d) of type (oci8 connection)
49resource(%d) of type (oci8 connection)
50resource(%d) of type (oci8 connection)
51Done
52