password_old.phpt 1.9 KB

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