1--TEST-- 2oci_password_change() for non-persistent connections 3--SKIPIF-- 4<?php 5if (!extension_loaded('oci8')) die("skip no oci8 extension"); 6require(dirname(__FILE__)."/details.inc"); 7if (empty($dbase)) die ("skip requires database connection string be set"); 8if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user"); 9if ($test_drcp) die("skip password change not supported in DRCP Mode"); 10?> 11--FILE-- 12<?php 13 14require(dirname(__FILE__)."/connect.inc"); 15 16$stmtarray = array( 17 "drop user testuser_pw cascade", 18 "create user testuser_pw identified by testuserpwd", 19 "grant connect, create session to testuser_pw" 20); 21 22oci8_test_sql_execute($c, $stmtarray); 23 24 25// Connect and change the password 26$c1 = oci_connect("testuser_pw", "testuserpwd", $dbase); 27var_dump($c1); 28$rn1 = (int)$c1; 29 30oci_password_change($c1, "testuser_pw", "testuserpwd", "testuserpwd2"); 31 32// Second connect should return a new resource because the hash string will be different from $c1 33$c2 = oci_connect("testuser_pw", "testuserpwd2", $dbase); 34var_dump($c2); 35$rn2 = (int)$c2; 36 37// Despite using the old password this connect should succeed and return the original resource 38$c3 = oci_connect("testuser_pw", "testuserpwd", $dbase); 39var_dump($c3); 40$rn3 = (int)$c3; 41 42// Connections should differ 43if ($rn1 == $rn2) { 44 echo "First and second connections share a resource: Not OK\n"; 45 var_dump($c1); 46} 47else { 48 echo "First and second connections are different: OK\n"; 49} 50 51// Connections should be the same 52if ($rn1 == $rn3) { 53 echo "First and third connections share a resource: OK\n"; 54} 55else { 56 echo "First and third connections are different: Not OK\n"; 57 var_dump($c1); 58 var_dump($c2); 59} 60 61echo "Done\n"; 62 63?> 64--CLEAN-- 65<?php 66 67require(dirname(__FILE__)."/connect.inc"); 68 69$stmtarray = array( 70 "drop user testuser_pw cascade" 71); 72 73oci8_test_sql_execute($c, $stmtarray); 74 75?> 76--EXPECTF-- 77resource(%d) of type (oci8 connection) 78resource(%d) of type (oci8 connection) 79resource(%d) of type (oci8 connection) 80First and second connections are different: OK 81First and third connections share a resource: OK 82Done 83