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