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