diff options
Diffstat (limited to 'ext/oci8/tests')
| -rw-r--r-- | ext/oci8/tests/bug43497.phpt | 11 | ||||
| -rw-r--r-- | ext/oci8/tests/bug43497_92.phpt | 303 | ||||
| -rw-r--r-- | ext/oci8/tests/bug44113.phpt | 5 | ||||
| -rw-r--r-- | ext/oci8/tests/drcp_cclass1.phpt | 4 | ||||
| -rw-r--r-- | ext/oci8/tests/drcp_connect1.phpt | 8 | ||||
| -rw-r--r-- | ext/oci8/tests/drcp_scope1.phpt | 1 | ||||
| -rw-r--r-- | ext/oci8/tests/drcp_scope2.phpt | 1 | ||||
| -rw-r--r-- | ext/oci8/tests/drcp_scope3.phpt | 61 | ||||
| -rw-r--r-- | ext/oci8/tests/drcp_scope4.phpt | 57 | ||||
| -rw-r--r-- | ext/oci8/tests/drcp_scope5.phpt | 63 | ||||
| -rw-r--r-- | ext/oci8/tests/password.phpt | 68 | ||||
| -rw-r--r-- | ext/oci8/tests/password_2.phpt | 32 | ||||
| -rw-r--r-- | ext/oci8/tests/password_new.phpt | 17 | ||||
| -rw-r--r-- | ext/oci8/tests/password_old.phpt | 25 | ||||
| -rw-r--r-- | ext/oci8/tests/pecl_bug10194_blob.phpt | 4 | ||||
| -rw-r--r-- | ext/oci8/tests/pecl_bug10194_blob_64.phpt | 2 | ||||
| -rw-r--r-- | ext/oci8/tests/testping.phpt | 2 |
17 files changed, 611 insertions, 53 deletions
diff --git a/ext/oci8/tests/bug43497.phpt b/ext/oci8/tests/bug43497.phpt index 908fe58972..0fc6a97b35 100644 --- a/ext/oci8/tests/bug43497.phpt +++ b/ext/oci8/tests/bug43497.phpt @@ -1,7 +1,16 @@ --TEST-- Bug #43497 (OCI8 XML/getClobVal aka temporary LOBs leak UGA memory) --SKIPIF-- -<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?> +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +ob_start(); +phpinfo(INFO_MODULES); +$phpinfo = ob_get_clean(); +$ov = preg_match('/Oracle Version => 9/', $phpinfo); +if ($ov === 1) { + die ("skip expected output only valid for Oracle clients from 10g onwards"); +} +?> --FILE-- <?php diff --git a/ext/oci8/tests/bug43497_92.phpt b/ext/oci8/tests/bug43497_92.phpt new file mode 100644 index 0000000000..e2cb1ce486 --- /dev/null +++ b/ext/oci8/tests/bug43497_92.phpt @@ -0,0 +1,303 @@ +--TEST-- +Bug #43497 (OCI8 XML/getClobVal aka temporary LOBs leak UGA memory) +--SKIPIF-- +<?php +if (!extension_loaded('oci8')) die ("skip no oci8 extension"); +ob_start(); +phpinfo(INFO_MODULES); +$phpinfo = ob_get_clean(); +$ov = preg_match('/Oracle Version => 9.2/', $phpinfo); +if ($ov !== 1) { + die ("skip expected output only valid for Oracle 9.2 clients"); +} +?> +--FILE-- +<?php + +require dirname(__FILE__).'/connect.inc'; + +function sessionid($c) // determines and returns current session ID +{ + $query = "select sid from v\$session where audsid = userenv('sessionid')"; + + $stmt = oci_parse($c, $query); + + if (oci_execute($stmt, OCI_DEFAULT)) { + $row = oci_fetch($stmt); + return oci_result($stmt, 1); + } + + return null; +} + + +function templobs($c, $sid) // returns number of temporary LOBs +{ + $query = "select abstract_lobs from v\$temporary_lobs where sid = " . $sid; + + $stmt = oci_parse($c, $query); + + if (oci_execute($stmt, OCI_DEFAULT)) { + $row = oci_fetch($stmt); + $val = oci_result($stmt, 1); + oci_free_statement($stmt); + return $val; + } + return null; +} + + +// Read all XML data using explicit LOB locator +function readxmltab_ex($c) +{ + $stmt = oci_parse($c, "select extract(xml, '/').getclobval() from bug43497_tab"); + + $cntchk = 0; + if (oci_execute($stmt)) { + while ($result = oci_fetch_array($stmt, OCI_NUM)) { + $result[0]->free(); // cleanup properly + ++$cntchk; + } + } + echo "Loop count check = $cntchk\n"; +} + +// Read all XML data using explicit LOB locator but without freeing the temp lobs +function readxmltab_ex_nofree($c) +{ + $stmt = oci_parse($c, "select extract(xml, '/').getclobval() from bug43497_tab"); + + $cntchk = 0; + if (oci_execute($stmt)) { + while ($result = oci_fetch_array($stmt, OCI_NUM)) { + ++$cntchk; + } + } + echo "Loop count check = $cntchk\n"; +} + +// Read all XML data using implicit LOB locator +function readxmltab_im($c) +{ + $stmt = oci_parse($c, "select extract(xml, '/').getclobval() from bug43497_tab"); + + $cntchk = 0; + if (oci_execute($stmt)) { + while ($result = oci_fetch_array($stmt, OCI_NUM+OCI_RETURN_LOBS)) { + ++$cntchk; + } + } + echo "Loop count check = $cntchk\n"; +} + +function createxmltab($c) // create table w/ field of XML type +{ + @dropxmltab($c); + $stmt = oci_parse($c, "create table bug43497_tab (id number primary key, xml xmltype)"); + oci_execute($stmt); +} + +function dropxmltab($c) // delete table +{ + $stmt = oci_parse($c, "drop table bug43497_tab"); + oci_execute($stmt); +} + + +function fillxmltab($c) +{ + for ($id = 1; $id <= 100; $id++) { + + // create an XML element string with random data + $s = "<data>"; + for ($j = 0; $j < 128; $j++) { + $s .= rand(); + } + $s .= "</data>\n"; + for ($j = 0; $j < 4; $j++) { + $s .= $s; + } + $data = "<?xml version=\"1.0\"?><records>" . $s . "</records>"; + + // insert XML data into database + + $stmt = oci_parse($c, "insert into bug43497_tab(id, xml) values (:id, sys.xmltype.createxml(:xml))"); + oci_bind_by_name($stmt, ":id", $id); + $clob = oci_new_descriptor($c, OCI_D_LOB); + oci_bind_by_name($stmt, ":xml", $clob, -1, OCI_B_CLOB); + $clob->writetemporary($data); + oci_execute($stmt); + + $clob->close(); + $clob->free(); + } +} + + +// Initialize + +createxmltab($c); +fillxmltab($c); + +// Run Test + +$sid = sessionid($c); + +echo "Explicit LOB use\n"; +for ($i = 1; $i <= 10; $i++) { + echo "\nRun = " . $i . "\n"; + echo "Temporary LOBs = " . templobs($c, $sid) . "\n"; + readxmltab_ex($c); +} + +echo "\nImplicit LOB use\n"; +for ($i = 1; $i <= 10; $i++) { + echo "\nRun = " . $i . "\n"; + echo "Temporary LOBs = " . templobs($c, $sid) . "\n"; + readxmltab_im($c); +} + +echo "\nExplicit LOB with no free (i.e. a temp lob leak)\n"; +for ($i = 1; $i <= 10; $i++) { + echo "\nRun = " . $i . "\n"; + echo "Temporary LOBs = " . templobs($c, $sid) . "\n"; + readxmltab_ex_nofree($c); +} + + + +// Cleanup + +dropxmltab($c); + +oci_close($c); + +echo "Done\n"; +?> +--EXPECT-- +Explicit LOB use + +Run = 1 +Temporary LOBs = 0 +Loop count check = 100 + +Run = 2 +Temporary LOBs = 100 +Loop count check = 100 + +Run = 3 +Temporary LOBs = 200 +Loop count check = 100 + +Run = 4 +Temporary LOBs = 300 +Loop count check = 100 + +Run = 5 +Temporary LOBs = 400 +Loop count check = 100 + +Run = 6 +Temporary LOBs = 500 +Loop count check = 100 + +Run = 7 +Temporary LOBs = 600 +Loop count check = 100 + +Run = 8 +Temporary LOBs = 700 +Loop count check = 100 + +Run = 9 +Temporary LOBs = 800 +Loop count check = 100 + +Run = 10 +Temporary LOBs = 900 +Loop count check = 100 + +Implicit LOB use + +Run = 1 +Temporary LOBs = 1000 +Loop count check = 100 + +Run = 2 +Temporary LOBs = 1100 +Loop count check = 100 + +Run = 3 +Temporary LOBs = 1200 +Loop count check = 100 + +Run = 4 +Temporary LOBs = 1300 +Loop count check = 100 + +Run = 5 +Temporary LOBs = 1400 +Loop count check = 100 + +Run = 6 +Temporary LOBs = 1500 +Loop count check = 100 + +Run = 7 +Temporary LOBs = 1600 +Loop count check = 100 + +Run = 8 +Temporary LOBs = 1700 +Loop count check = 100 + +Run = 9 +Temporary LOBs = 1800 +Loop count check = 100 + +Run = 10 +Temporary LOBs = 1900 +Loop count check = 100 + +Explicit LOB with no free (i.e. a temp lob leak) + +Run = 1 +Temporary LOBs = 2000 +Loop count check = 100 + +Run = 2 +Temporary LOBs = 2100 +Loop count check = 100 + +Run = 3 +Temporary LOBs = 2200 +Loop count check = 100 + +Run = 4 +Temporary LOBs = 2300 +Loop count check = 100 + +Run = 5 +Temporary LOBs = 2400 +Loop count check = 100 + +Run = 6 +Temporary LOBs = 2500 +Loop count check = 100 + +Run = 7 +Temporary LOBs = 2600 +Loop count check = 100 + +Run = 8 +Temporary LOBs = 2700 +Loop count check = 100 + +Run = 9 +Temporary LOBs = 2800 +Loop count check = 100 + +Run = 10 +Temporary LOBs = 2900 +Loop count check = 100 +Done
\ No newline at end of file diff --git a/ext/oci8/tests/bug44113.phpt b/ext/oci8/tests/bug44113.phpt index 646f09b7c7..d6c2978635 100644 --- a/ext/oci8/tests/bug44113.phpt +++ b/ext/oci8/tests/bug44113.phpt @@ -5,7 +5,7 @@ Bug #44113 (New collection creation can fail with OCI-22303) --FILE-- <?php -require dirname(__FILE__).'/connect.inc'; +require(dirname(__FILE__).'/connect.inc'); // Initialization @@ -22,8 +22,7 @@ foreach ($stmtarray as $stmt) { // The test can take some time to complete and can exceed PHP's test // timout limit on slow networks. -for ($x = 0; $x < 70000; $x++) -{ +for ($x = 0; $x < 70000; $x++) { if (!($var = oci_new_collection($c, 'BUG44113_LIST_T'))) { print "Failed new collection creation on $x\n"; break; diff --git a/ext/oci8/tests/drcp_cclass1.phpt b/ext/oci8/tests/drcp_cclass1.phpt index 4036da773f..ff45f73f73 100644 --- a/ext/oci8/tests/drcp_cclass1.phpt +++ b/ext/oci8/tests/drcp_cclass1.phpt @@ -3,14 +3,14 @@ DRCP: Test setting connection class inline --SKIPIF-- <?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); -require(__DIR__."/details.inc"); +require(dirname(__FILE__)."/details.inc"); if (!$test_drcp) die("skip testing DRCP connection class only works in DRCP mode"); if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user"); ?> --FILE-- <?php -require(__DIR__."/details.inc"); +require(dirname(__FILE__)."/details.inc"); // Initialization diff --git a/ext/oci8/tests/drcp_connect1.phpt b/ext/oci8/tests/drcp_connect1.phpt index d639d5684e..bf619a4efd 100644 --- a/ext/oci8/tests/drcp_connect1.phpt +++ b/ext/oci8/tests/drcp_connect1.phpt @@ -1,11 +1,7 @@ --TEST-- DRCP: oci_connect() --SKIPIF-- -<?php -if (!extension_loaded('oci8')) die("skip no oci8 extension"); -require(dirname(__FILE__)."/details.inc"); -if (!$test_drcp) die("skip expected test results are only valid for DRCP Mode"); -?> +<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> --INI-- oci8.connection_class=test oci8.old_oci_close_semantics=0 @@ -54,7 +50,7 @@ drcp_set_packagevar($pconn1,1000); oci_close($pconn1); echo " Connection pconn1 closed....\n"; -// Second conenction with oci_pconnect should return the same session hence the +// Second connection with oci_pconnect should return the same session hence the // value returned is what is set by pconn1 var_dump($pconn2 = oci_pconnect($user,$password,$dbase)); diff --git a/ext/oci8/tests/drcp_scope1.phpt b/ext/oci8/tests/drcp_scope1.phpt index 01b0a4271e..57f1abe327 100644 --- a/ext/oci8/tests/drcp_scope1.phpt +++ b/ext/oci8/tests/drcp_scope1.phpt @@ -19,6 +19,7 @@ require dirname(__FILE__)."/details.inc"; // Create the table $c = oci_new_connect($user,$password,$dbase); +@drcp_drop_table($c); drcp_create_table($c); // OCI_NEW_CONNECT diff --git a/ext/oci8/tests/drcp_scope2.phpt b/ext/oci8/tests/drcp_scope2.phpt index cb5dcd1ac1..b72e00dbb0 100644 --- a/ext/oci8/tests/drcp_scope2.phpt +++ b/ext/oci8/tests/drcp_scope2.phpt @@ -19,6 +19,7 @@ require dirname(__FILE__)."/details.inc"; // Create the table $c = oci_new_connect($user,$password,$dbase); +@drcp_drop_table($c); drcp_create_table($c); // OCI_NEW_CONNECT diff --git a/ext/oci8/tests/drcp_scope3.phpt b/ext/oci8/tests/drcp_scope3.phpt new file mode 100644 index 0000000000..b448a518ad --- /dev/null +++ b/ext/oci8/tests/drcp_scope3.phpt @@ -0,0 +1,61 @@ +--TEST-- +DRCP: oci_pconnect() with scope end when oci8.old_oci_close_semantics ON +--SKIPIF-- +<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> +--INI-- +oci8.old_oci_close_semantics=1 +--FILE-- +<?php + +require dirname(__FILE__)."/drcp_functions.inc"; +require dirname(__FILE__)."/details.inc"; + +// The test opens a connection within function1 and updates a table +// (without committing). Another connection is opened from function +// 2, and the table queried. When function1 ends, the connection from +// function1 is not closed, so the updated value will be seen in +// function2. Also the table can't be dropped because an uncommitted +// transaction exists. + +// Create the table +$c = oci_new_connect($user,$password,$dbase); +@drcp_drop_table($c); +drcp_create_table($c); + +echo "This is with a OCI_PCONNECT\n"; +function1($user,$password,$dbase); + +// Should return the OLD value +function2($user,$password,$dbase); + +// This is the first scope for the script + +function function1($user,$password,$dbase) +{ + var_dump($c = oci_pconnect($user,$password,$dbase)); + drcp_update_table($c); +} + +// This is the second scope + +function function2($user,$password,$dbase) +{ + var_dump($c = oci_pconnect($user,$password,$dbase)); + drcp_select_value($c); +} + +drcp_drop_table($c); +oci_close($c); + +echo "Done\n"; + +?> +--EXPECTF-- +This is with a OCI_PCONNECT +resource(%d) of type (oci8 persistent connection) +Update done-- DEPT value has been set to NEWDEPT +resource(%d) of type (oci8 persistent connection) +The value of DEPT for id 105 is NEWDEPT + +Warning: oci_execute(): ORA-00054: %s +Done
\ No newline at end of file diff --git a/ext/oci8/tests/drcp_scope4.phpt b/ext/oci8/tests/drcp_scope4.phpt new file mode 100644 index 0000000000..07110bca0e --- /dev/null +++ b/ext/oci8/tests/drcp_scope4.phpt @@ -0,0 +1,57 @@ +--TEST-- +DRCP: oci_pconnect() with scope end when oci8.old_oci_close_semantics OFF +--SKIPIF-- +<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> +--INI-- +oci8.old_oci_close_semantics=0 +--FILE-- +<?php + +require dirname(__FILE__)."/drcp_functions.inc"; +require dirname(__FILE__)."/details.inc"; + +// The test opens a connection within function1 and updates a table +// (without committing). Another connection is opened from function +// 2, and the table queried. When function1 ends, the txn is rolled +// back and hence the updated value will not be reflected in function2 + +// Create the table +$c = oci_new_connect($user,$password,$dbase); +@drcp_drop_table($c); +drcp_create_table($c); + +echo "This is with a OCI_PCONNECT\n"; +function1($user,$password,$dbase); + +// Should return the OLD value +function2($user,$password,$dbase); + +// This is the first scope for the script + +function function1($user,$password,$dbase) +{ + var_dump($c = oci_pconnect($user,$password,$dbase)); + drcp_update_table($c); +} + +// This is the second scope + +function function2($user,$password,$dbase) +{ + var_dump($c = oci_pconnect($user,$password,$dbase)); + drcp_select_value($c); +} + +drcp_drop_table($c); +oci_close($c); + +echo "Done\n"; + +?> +--EXPECTF-- +This is with a OCI_PCONNECT +resource(%d) of type (oci8 persistent connection) +Update done-- DEPT value has been set to NEWDEPT +resource(%d) of type (oci8 persistent connection) +The value of DEPT for id 105 is HR +Done diff --git a/ext/oci8/tests/drcp_scope5.phpt b/ext/oci8/tests/drcp_scope5.phpt new file mode 100644 index 0000000000..832e6aa8cb --- /dev/null +++ b/ext/oci8/tests/drcp_scope5.phpt @@ -0,0 +1,63 @@ +--TEST-- +DRCP: oci_pconnect() with scope end when oci8.old_oci_close_semantics ON +--SKIPIF-- +<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?> +--INI-- +oci8.old_oci_close_semantics=1 +--FILE-- +<?php + +require dirname(__FILE__)."/drcp_functions.inc"; +require dirname(__FILE__)."/details.inc"; + +// Similar to drcp_scope3.phpt but does a commit before end of +// function2, allowing the table to be dropped cleanly at the end. + +// The test opens a connection within function1 and updates a table +// (without committing). Another connection is opened from function +// 2, and the table queried. When function1 ends, the connection from +// function1 is not closed, so the updated value will be seen in +// function2. Also the table can't be dropped because an uncommitted +// transaction exists. + +// Create the table +$c = oci_new_connect($user,$password,$dbase); +@drcp_drop_table($c); +drcp_create_table($c); + +echo "This is with a OCI_PCONNECT\n"; +function1($user,$password,$dbase); + +// Should return the OLD value +function2($user,$password,$dbase); + +// This is the first scope for the script + +function function1($user,$password,$dbase) +{ + var_dump($c = oci_pconnect($user,$password,$dbase)); + drcp_update_table($c); +} + +// This is the second scope + +function function2($user,$password,$dbase) +{ + var_dump($c = oci_pconnect($user,$password,$dbase)); + drcp_select_value($c); + oci_commit($c); +} + +drcp_drop_table($c); +oci_close($c); + +echo "Done\n"; + +?> +--EXPECTF-- +This is with a OCI_PCONNECT +resource(%d) of type (oci8 persistent connection) +Update done-- DEPT value has been set to NEWDEPT +resource(%d) of type (oci8 persistent connection) +The value of DEPT for id 105 is NEWDEPT +Done
\ No newline at end of file diff --git a/ext/oci8/tests/password.phpt b/ext/oci8/tests/password.phpt index a7de393a25..7133d8bae8 100644 --- a/ext/oci8/tests/password.phpt +++ b/ext/oci8/tests/password.phpt @@ -1,27 +1,75 @@ --TEST-- -oci_password_change() +oci_password_change() for non-persistent connections --SKIPIF-- <?php -if (!extension_loaded('oci8')) die("skip no oci8 extension"); +if (!extension_loaded('oci8')) die("skip no oci8 extension"); +require(dirname(__FILE__)."/details.inc"); +if (empty($dbase)) die ("skip requires database connection string be set"); +if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user"); if ($test_drcp) die("skip password change not supported in DRCP Mode"); ?> --FILE-- <?php -require dirname(__FILE__)."/connect.inc"; +require(dirname(__FILE__)."/details.inc"); -$new_password = "test"; -var_dump(oci_password_change($dbase, $user, $password, $new_password)); +// Create a user we can stuff around with and not affect subsequent tests +$c0 = oci_connect($user, $password, $dbase); +$stmts = array( + "drop user testuser", + "begin + execute immediate 'create user testuser identified by testuserpwd'; + execute immediate 'grant connect, create session to testuser'; + end;"); +foreach ($stmts as $sql) { + $s = oci_parse($c0, $sql); + @oci_execute($s); +} + +// Connect and change the password +$c1 = oci_connect("testuser", "testuserpwd", $dbase); +var_dump($c1); +$rn1 = (int)$c1; + +oci_password_change($c1, "testuser", "testuserpwd", "testuserpwd2"); + +// Second connect should return a new resource because the hash string will be different from $c1 +$c2 = oci_connect("testuser", "testuserpwd2", $dbase); +var_dump($c2); +$rn2 = (int)$c2; + +// Despite using the old password this connect should succeed and return the original resource +$c3 = oci_connect("testuser", "testuserpwd", $dbase); +var_dump($c3); +$rn3 = (int)$c3; + +// Connections should differ +if ($rn1 == $rn2) { + echo "First and second connections share a resource: Not OK\n"; + var_dump($c1); +} +else { + echo "First and second connections are different: OK\n"; +} -if (!empty($dbase)) { - var_dump($new_c = ocilogon($user,$new_password,$dbase)); +// Connections should be the same +if ($rn1 == $rn3) { + echo "First and third connections share a resource: OK\n"; } else { - var_dump($new_c = ocilogon($user,$new_password)); + echo "First and third connections are different: Not OK\n"; + var_dump($c1); + var_dump($c2); } -var_dump(oci_password_change($dbase, $user, $new_password, $password)); +// Clean up +oci_close($c1); +oci_close($c2); +oci_close($c3); +// Clean up +$s = oci_parse($c0, "drop user cascade testuser"); +@oci_execute($s); echo "Done\n"; @@ -30,4 +78,6 @@ echo "Done\n"; resource(%d) of type (oci8 connection) resource(%d) of type (oci8 connection) resource(%d) of type (oci8 connection) +First and second connections are different: OK +First and third connections share a resource: OK Done diff --git a/ext/oci8/tests/password_2.phpt b/ext/oci8/tests/password_2.phpt index 3ee2db5b40..71423e717b 100644 --- a/ext/oci8/tests/password_2.phpt +++ b/ext/oci8/tests/password_2.phpt @@ -4,6 +4,7 @@ oci_password_change() for persistent connections <?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); require(dirname(__FILE__)."/details.inc"); +if (empty($dbase)) die ("skip requires database connection string be set"); if (strcasecmp($user, "system") && strcasecmp($user, "sys")) die("skip needs to be run as a DBA user"); if ($test_drcp) die("skip password change not supported in DRCP Mode"); ?> @@ -28,34 +29,19 @@ foreach ($stmts as $sql) { // Connect (persistent) and change the password $c1 = oci_pconnect("testuser", "testuserpwd", $dbase); var_dump($c1); - -ob_start(); -var_dump($c1); -$r1 = ob_get_clean(); -preg_match("/resource\(([0-9]*)\) of.*/", $r1, $matches); -$rn1 = $matches[0]; /* resource number */ +$rn1 = (int)$c1; oci_password_change($c1, "testuser", "testuserpwd", "testuserpwd2"); // Second connect should return a new resource because the hash string will be different from $c1 $c2 = oci_pconnect("testuser", "testuserpwd2", $dbase); var_dump($c2); - -ob_start(); -var_dump($c2); -$r2 = ob_get_clean(); -preg_match("/resource\(([0-9]*)\) of.*/", $r2, $matches); -$rn2 = $matches[0]; /* resource number */ +$rn2 = (int)$c2; // Despite using the old password this connect should succeed and return the original resource $c3 = oci_pconnect("testuser", "testuserpwd", $dbase); var_dump($c3); - -ob_start(); -var_dump($c3); -$r3 = ob_get_clean(); -preg_match("/resource\(([0-9]*)\) of.*/", $r3, $matches); -$rn3 = $matches[0]; /* resource number */ +$rn3 = (int)$c3; // Connections should differ if ($rn1 == $rn2) { @@ -77,10 +63,12 @@ else { } // Clean up -// Can't drop a user that is connected and can't close a persistent -// connection. So this test will leave the dummy user around, but the -// schema will not be usable.. -$s = oci_parse($c0, "revoke connect, create session from testuser"); +oci_close($c1); +oci_close($c2); +oci_close($c3); + +// Clean up +$s = oci_parse($c0, "drop user cascade testuser"); @oci_execute($s); echo "Done\n"; diff --git a/ext/oci8/tests/password_new.phpt b/ext/oci8/tests/password_new.phpt index 1de3cb4c96..e8642abca7 100644 --- a/ext/oci8/tests/password_new.phpt +++ b/ext/oci8/tests/password_new.phpt @@ -3,8 +3,23 @@ oci_password_change() --SKIPIF-- <?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); -require dirname(__FILE__)."/details.inc"; +require dirname(__FILE__)."/connect.inc"; +if (empty($dbase)) die ("skip requires database connection string be set"); if ($test_drcp) die("skip password change not supported in DRCP Mode"); + +// This test is known to fail with Oracle 10g client libraries +// connecting to Oracle Database 11.1.0.6 (Oracle bug 6277160) +$sv = oci_server_version($c); +$sv = preg_match('/11.1/', $sv, $matches); +if ($sv === 1) { + ob_start(); + phpinfo(INFO_MODULES); + $phpinfo = ob_get_clean(); + $iv = preg_match('/Oracle .*Version => 10/', $phpinfo); + if ($iv === 1) { + die ("skip test known to fail using Oracle 10gR2 client libs connecting to Oracle 11.1 (6277160)"); + } +} ?> --FILE-- <?php diff --git a/ext/oci8/tests/password_old.phpt b/ext/oci8/tests/password_old.phpt index 7a2df841e7..157bdebcaa 100644 --- a/ext/oci8/tests/password_old.phpt +++ b/ext/oci8/tests/password_old.phpt @@ -3,8 +3,23 @@ ocipasswordchange() --SKIPIF-- <?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); -require dirname(__FILE__)."/details.inc"; +require dirname(__FILE__)."/connect.inc"; +if (empty($dbase)) die ("skip requires database connection string be set"); if ($test_drcp) die("skip password change not supported in DRCP Mode"); + +// This test is known to fail with Oracle 10g client libraries +// connecting to Oracle Database 11.1.0.6 (Oracle bug 6277160) +$sv = oci_server_version($c); +$sv = preg_match('/11.1/', $sv, $matches); +if ($sv === 1) { + ob_start(); + phpinfo(INFO_MODULES); + $phpinfo = ob_get_clean(); + $iv = preg_match('/Oracle .*Version => 10/', $phpinfo); + if ($iv === 1) { + die ("skip test known to fail using Oracle 10gR2 client libs connecting to Oracle 11.1 (6277160)"); + } +} ?> --FILE-- <?php @@ -12,7 +27,7 @@ if ($test_drcp) die("skip password change not supported in DRCP Mode"); require dirname(__FILE__)."/connect.inc"; $new_password = "test"; -var_dump(ocipasswordchange($c, $user, $password, $new_password)); +var_dump(ocipasswordchange($dbase, $user, $password, $new_password)); if (!empty($dbase)) { var_dump($new_c = ocilogon($user,$new_password,$dbase)); @@ -21,14 +36,14 @@ else { var_dump($new_c = ocilogon($user,$new_password)); } -var_dump(ocipasswordchange($new_c, $user, $new_password, $password)); +var_dump(ocipasswordchange($dbase, $user, $new_password, $password)); echo "Done\n"; ?> --EXPECTF-- -bool(true) resource(%d) of type (oci8 connection) -bool(true) +resource(%d) of type (oci8 connection) +resource(%d) of type (oci8 connection) Done diff --git a/ext/oci8/tests/pecl_bug10194_blob.phpt b/ext/oci8/tests/pecl_bug10194_blob.phpt index c9d6b14b33..737ef8ec00 100644 --- a/ext/oci8/tests/pecl_bug10194_blob.phpt +++ b/ext/oci8/tests/pecl_bug10194_blob.phpt @@ -1,9 +1,9 @@ --TEST-- PECL Bug #10194 (segfault in Instant Client when memory_limit is reached inside the callback) --SKIPIF-- -<?php +<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); -if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); +if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platforms only"); ?> --INI-- memory_limit=9M diff --git a/ext/oci8/tests/pecl_bug10194_blob_64.phpt b/ext/oci8/tests/pecl_bug10194_blob_64.phpt index 9b98989f38..433d586a4e 100644 --- a/ext/oci8/tests/pecl_bug10194_blob_64.phpt +++ b/ext/oci8/tests/pecl_bug10194_blob_64.phpt @@ -3,7 +3,7 @@ PECL Bug #10194 (segfault in Instant Client when memory_limit is reached inside --SKIPIF-- <?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); -if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); +if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platforms only"); ?> --INI-- memory_limit=6M diff --git a/ext/oci8/tests/testping.phpt b/ext/oci8/tests/testping.phpt index 1556d81d1e..a0d65a30c3 100644 --- a/ext/oci8/tests/testping.phpt +++ b/ext/oci8/tests/testping.phpt @@ -7,7 +7,7 @@ oci8.ping_interval=0 --FILE-- <?php -require(__DIR__.'/details.inc'); +require(dirname(__FILE__).'/details.inc'); for ($i = 0; $i < 2; $i++) { if (!empty($dbase)) { |
