From: Christopher Jones Date: Wed, 7 May 2008 15:29:27 +0000 (+0000) Subject: MFH: new tests and test cleanup X-Git-Tag: RELEASE_1_2_5~23 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fc4cfc3c839b1f4b1cae89f2ce2673ac0778fe7f;p=php MFH: new tests and test cleanup --- diff --git a/ext/oci8/tests/bug37220.phpt b/ext/oci8/tests/bug37220.phpt new file mode 100644 index 0000000000..6743165b70 --- /dev/null +++ b/ext/oci8/tests/bug37220.phpt @@ -0,0 +1,68 @@ +--TEST-- +Bug #37220 (LOB Type mismatch when using windows & oci8.dll) +--SKIPIF-- + +--FILE-- +'))" +); + +foreach ($stmtarray as $stmt) { + $s = oci_parse($c, $stmt); + @oci_execute($s); +} + +// Now let's update the row where myId = 1234 and change the tag +// 'THETAG' to 'MYTAG' (mycolumn is an XMLTYPE datatype and +// bug37220_tab a normal Oracle table) + +$query = "UPDATE bug37220_tab + SET bug37220_tab.mycolumn = updateXML(bug37220_tab.mycolumn,'/THETAG',xmltype.createXML(:data)) + WHERE existsNode(bug37220_tab.mycolumn,'/THETAG[@myID=\"1234\"]') = 1"; +$stmt = oci_parse ($c, $query); +$clob = oci_new_descriptor($c, OCI_D_LOB); +oci_bind_by_name($stmt, ':data', $clob, -1, OCI_B_CLOB); +$clob->writetemporary("", OCI_TEMP_CLOB); +$success = oci_execute($stmt, OCI_COMMIT_ON_SUCCESS); +oci_free_statement($stmt); +$clob->close(); + +// Query back the change + +$query = "select * from bug37220_tab"; +$stmt = oci_parse ($c, $query); + +oci_execute($stmt); + +while ($row = oci_fetch_array($stmt, OCI_ASSOC+OCI_RETURN_NULLS)) { + foreach ($row as $item) { + echo $item."\n"; + } + echo "\n"; +} + +// Cleanup + +$stmtarray = array( + "drop table bug37220_tab" +); + +foreach ($stmtarray as $stmt) { + $s = oci_parse($c, $stmt); + oci_execute($s); +} + +echo "Done\n"; + +?> +--EXPECT-- + + +Done 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-- - + 9/', $phpinfo); +if ($ov === 1) { + die ("skip expected output only valid for Oracle clients from 10g onwards"); +} +?> --FILE-- 9.2/', $phpinfo); +if ($ov !== 1) { + die ("skip expected output only valid for Oracle 9.2 clients"); +} +?> +--FILE-- +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 = ""; + for ($j = 0; $j < 128; $j++) { + $s .= rand(); + } + $s .= "\n"; + for ($j = 0; $j < 4; $j++) { + $s .= $s; + } + $data = "" . $s . ""; + + // 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-- +--FILE-- + +--EXPECTF-- +Test 1 - oci_connect +array(1) { + ["C1"]=> + array(0) { + } +} +array(1) { + ["C1"]=> + array(2) { + [0]=> + string(1) "1" + [1]=> + string(1) "1" + } +} +Done diff --git a/ext/oci8/tests/connect_scope2.phpt b/ext/oci8/tests/connect_scope2.phpt new file mode 100644 index 0000000000..7017493f5a --- /dev/null +++ b/ext/oci8/tests/connect_scope2.phpt @@ -0,0 +1,93 @@ +--TEST-- +Test oci_pconnect end-of-scope when statement returned +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Test 1 - oci_pconnect +array(1) { + ["C1"]=> + array(0) { + } +} +array(1) { + ["C1"]=> + array(2) { + [0]=> + string(1) "1" + [1]=> + string(1) "1" + } +} +Done diff --git a/ext/oci8/tests/connect_scope_try1.phpt b/ext/oci8/tests/connect_scope_try1.phpt new file mode 100644 index 0000000000..a881ea6ead --- /dev/null +++ b/ext/oci8/tests/connect_scope_try1.phpt @@ -0,0 +1,100 @@ +--TEST-- +Check oci_connect try/catch end-of-scope with old_oci_close_semantics Off +--SKIPIF-- + +--INI-- +oci8.old_oci_close_semantics=0 +--FILE-- + throws exception + oci_execute($s, OCI_DEFAULT); // no commit +} +catch (Exception $e) +{ + echo "Caught Exception: ". $e->getMessage(), "\n"; + var_dump($c); + + // Verify data is not yet committed + $s1 = oci_parse($c1, "select * from scope_try1_tab"); + oci_execute($s1); + oci_fetch_all($s1, $r); + var_dump($r); + + // Now commit + oci_commit($c); +} + +// Verify data was committed in the Catch block + +$s1 = oci_parse($c1, "select * from scope_try1_tab"); +oci_execute($s1); +oci_fetch_all($s1, $r); +var_dump($r); + +// Cleanup + +$stmtarray = array( + "drop table scope_try1_tab" +); + +foreach ($stmtarray as $stmt) { + $s1 = oci_parse($c1, $stmt); + oci_execute($s1); +} + +echo "Done\n"; + +?> +--EXPECTF-- +Test 1 +Caught Exception: oci_execute(): ORA-00984: %s +resource(%d) of type (oci8 connection) +array(1) { + ["C1"]=> + array(0) { + } +} +array(1) { + ["C1"]=> + array(1) { + [0]=> + string(1) "1" + } +} +Done diff --git a/ext/oci8/tests/connect_scope_try2.phpt b/ext/oci8/tests/connect_scope_try2.phpt new file mode 100644 index 0000000000..9e6b5ce2e0 --- /dev/null +++ b/ext/oci8/tests/connect_scope_try2.phpt @@ -0,0 +1,100 @@ +--TEST-- +Check oci_connect try/catch end-of-scope with old_oci_close_semantics On +--SKIPIF-- + +--INI-- +oci8.old_oci_close_semantics=1 +--FILE-- + throws exception + oci_execute($s, OCI_DEFAULT); // no commit +} +catch (Exception $e) +{ + echo "Caught Exception: ". $e->getMessage(), "\n"; + var_dump($c); + + // Verify data is not yet committed + $s1 = oci_parse($c1, "select * from scope_try2_tab"); + oci_execute($s1); + oci_fetch_all($s1, $r); + var_dump($r); + + // Now commit + oci_commit($c); +} + +// Verify data was committed in the Catch block + +$s1 = oci_parse($c1, "select * from scope_try2_tab"); +oci_execute($s1); +oci_fetch_all($s1, $r); +var_dump($r); + +// Cleanup + +$stmtarray = array( + "drop table scope_try2_tab" +); + +foreach ($stmtarray as $stmt) { + $s1 = oci_parse($c1, $stmt); + oci_execute($s1); +} + +echo "Done\n"; + +?> +--EXPECTF-- +Test 1 +Caught Exception: oci_execute(): ORA-00984: %s +resource(%d) of type (oci8 connection) +array(1) { + ["C1"]=> + array(0) { + } +} +array(1) { + ["C1"]=> + array(1) { + [0]=> + string(1) "1" + } +} +Done diff --git a/ext/oci8/tests/connect_scope_try3.phpt b/ext/oci8/tests/connect_scope_try3.phpt new file mode 100644 index 0000000000..1cd44b0218 --- /dev/null +++ b/ext/oci8/tests/connect_scope_try3.phpt @@ -0,0 +1,100 @@ +--TEST-- +Check oci_new_connect try/catch end-of-scope with old_oci_close_semantics Off +--SKIPIF-- + +--INI-- +oci8.old_oci_close_semantics=0 +--FILE-- + throws exception + oci_execute($s, OCI_DEFAULT); // no commit +} +catch (Exception $e) +{ + echo "Caught Exception: ". $e->getMessage(), "\n"; + var_dump($c); + + // Verify data is not yet committed + $s1 = oci_parse($c1, "select * from scope_try3_tab"); + oci_execute($s1); + oci_fetch_all($s1, $r); + var_dump($r); + + // Now commit + oci_commit($c); +} + +// Verify data was committed in the Catch block + +$s1 = oci_parse($c1, "select * from scope_try3_tab"); +oci_execute($s1); +oci_fetch_all($s1, $r); +var_dump($r); + +// Cleanup + +$stmtarray = array( + "drop table scope_try3_tab" +); + +foreach ($stmtarray as $stmt) { + $s1 = oci_parse($c1, $stmt); + oci_execute($s1); +} + +echo "Done\n"; + +?> +--EXPECTF-- +Test 1 +Caught Exception: oci_execute(): ORA-00984: %s +resource(%d) of type (oci8 connection) +array(1) { + ["C1"]=> + array(0) { + } +} +array(1) { + ["C1"]=> + array(1) { + [0]=> + string(1) "1" + } +} +Done diff --git a/ext/oci8/tests/connect_scope_try4.phpt b/ext/oci8/tests/connect_scope_try4.phpt new file mode 100644 index 0000000000..9b4cd1f278 --- /dev/null +++ b/ext/oci8/tests/connect_scope_try4.phpt @@ -0,0 +1,100 @@ +--TEST-- +Check oci_new_connect try/catch end-of-scope with old_oci_close_semantics On +--SKIPIF-- + +--INI-- +oci8.old_oci_close_semantics=1 +--FILE-- + throws exception + oci_execute($s, OCI_DEFAULT); // no commit +} +catch (Exception $e) +{ + echo "Caught Exception: ". $e->getMessage(), "\n"; + var_dump($c); + + // Verify data is not yet committed + $s1 = oci_parse($c1, "select * from scope_try4_tab"); + oci_execute($s1); + oci_fetch_all($s1, $r); + var_dump($r); + + // Now commit + oci_commit($c); +} + +// Verify data was committed in the Catch block + +$s1 = oci_parse($c1, "select * from scope_try4_tab"); +oci_execute($s1); +oci_fetch_all($s1, $r); +var_dump($r); + +// Cleanup + +$stmtarray = array( + "drop table scope_try4_tab" +); + +foreach ($stmtarray as $stmt) { + $s1 = oci_parse($c1, $stmt); + oci_execute($s1); +} + +echo "Done\n"; + +?> +--EXPECTF-- +Test 1 +Caught Exception: oci_execute(): ORA-00984: %s +resource(%d) of type (oci8 connection) +array(1) { + ["C1"]=> + array(0) { + } +} +array(1) { + ["C1"]=> + array(1) { + [0]=> + string(1) "1" + } +} +Done diff --git a/ext/oci8/tests/connect_scope_try5.phpt b/ext/oci8/tests/connect_scope_try5.phpt new file mode 100644 index 0000000000..121fb33dc5 --- /dev/null +++ b/ext/oci8/tests/connect_scope_try5.phpt @@ -0,0 +1,100 @@ +--TEST-- +Check oci_pconnect try/catch end-of-scope with old_oci_close_semantics Off +--SKIPIF-- + +--INI-- +oci8.old_oci_close_semantics=0 +--FILE-- + throws exception + oci_execute($s, OCI_DEFAULT); // no commit +} +catch (Exception $e) +{ + echo "Caught Exception: ". $e->getMessage(), "\n"; + var_dump($c); + + // Verify data is not yet committed + $s1 = oci_parse($c1, "select * from scope_try5_tab"); + oci_execute($s1); + oci_fetch_all($s1, $r); + var_dump($r); + + // Now commit + oci_commit($c); +} + +// Verify data was committed in the Catch block + +$s1 = oci_parse($c1, "select * from scope_try5_tab"); +oci_execute($s1); +oci_fetch_all($s1, $r); +var_dump($r); + +// Cleanup + +$stmtarray = array( + "drop table scope_try5_tab" +); + +foreach ($stmtarray as $stmt) { + $s1 = oci_parse($c1, $stmt); + oci_execute($s1); +} + +echo "Done\n"; + +?> +--EXPECTF-- +Test 1 +Caught Exception: oci_execute(): ORA-00984: %s +resource(%d) of type (oci8 persistent connection) +array(1) { + ["C1"]=> + array(0) { + } +} +array(1) { + ["C1"]=> + array(1) { + [0]=> + string(1) "1" + } +} +Done diff --git a/ext/oci8/tests/connect_scope_try6.phpt b/ext/oci8/tests/connect_scope_try6.phpt new file mode 100644 index 0000000000..3347543ab8 --- /dev/null +++ b/ext/oci8/tests/connect_scope_try6.phpt @@ -0,0 +1,100 @@ +--TEST-- +Check oci_pconnect try/catch end-of-scope with old_oci_close_semantics On +--SKIPIF-- + +--INI-- +oci8.old_oci_close_semantics=1 +--FILE-- + throws exception + oci_execute($s, OCI_DEFAULT); // no commit +} +catch (Exception $e) +{ + echo "Caught Exception: ". $e->getMessage(), "\n"; + var_dump($c); + + // Verify data is not yet committed + $s1 = oci_parse($c1, "select * from scope_try6_tab"); + oci_execute($s1); + oci_fetch_all($s1, $r); + var_dump($r); + + // Now commit + oci_commit($c); +} + +// Verify data was committed in the Catch block + +$s1 = oci_parse($c1, "select * from scope_try6_tab"); +oci_execute($s1); +oci_fetch_all($s1, $r); +var_dump($r); + +// Cleanup + +$stmtarray = array( + "drop table scope_try6_tab" +); + +foreach ($stmtarray as $stmt) { + $s1 = oci_parse($c1, $stmt); + oci_execute($s1); +} + +echo "Done\n"; + +?> +--EXPECTF-- +Test 1 +Caught Exception: oci_execute(): ORA-00984: %s +resource(%d) of type (oci8 persistent connection) +array(1) { + ["C1"]=> + array(0) { + } +} +array(1) { + ["C1"]=> + array(1) { + [0]=> + string(1) "1" + } +} +Done diff --git a/ext/oci8/tests/drcp_characterset.phpt b/ext/oci8/tests/drcp_characterset.phpt new file mode 100644 index 0000000000..657d4c5bab --- /dev/null +++ b/ext/oci8/tests/drcp_characterset.phpt @@ -0,0 +1,61 @@ +--TEST-- +DRCP: oci_pconnect() and oci_connect() with different character sets +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +resource(%d) of type (oci8 connection) +resource(%d) of type (oci8 persistent connection) +resource(%d) of type (oci8 connection) +resource(%d) of type (oci8 persistent connection) +First and third connections are different: OK +Second and fourth connections are different: OK +Done diff --git a/ext/oci8/tests/drcp_conn_close1.phpt b/ext/oci8/tests/drcp_conn_close1.phpt new file mode 100644 index 0000000000..697b7e3575 --- /dev/null +++ b/ext/oci8/tests/drcp_conn_close1.phpt @@ -0,0 +1,45 @@ +--TEST-- +DRCP: oci_connect() with oci_close() and oci8.old_oci_close_semantics ON +--SKIPIF-- + +--INI-- +oci8.old_oci_close_semantics=1 +oci8.connection_class=test +--FILE-- + +--EXPECTF-- +This is with a OCI_CONNECT +resource(%d) of type (oci8 connection) +resource(%d) of type (oci8 connection) +Both connections share a resource : OK +Done diff --git a/ext/oci8/tests/drcp_conn_close2.phpt b/ext/oci8/tests/drcp_conn_close2.phpt new file mode 100644 index 0000000000..0d3f8247f2 --- /dev/null +++ b/ext/oci8/tests/drcp_conn_close2.phpt @@ -0,0 +1,46 @@ +--TEST-- +DRCP: oci_connect() with oci_close() and oci8.old_oci_close_semantics OFF +--SKIPIF-- + +--INI-- +oci8.old_oci_close_semantics=0 +oci8.connection_class=test +--FILE-- + +--EXPECTF-- +This is with a OCI_CONNECT +resource(%d) of type (oci8 connection) +resource(%d) of type (oci8 connection) +Both connections are different : OK +Done diff --git a/ext/oci8/tests/drcp_connect1.phpt b/ext/oci8/tests/drcp_connect1.phpt new file mode 100644 index 0000000000..bf619a4efd --- /dev/null +++ b/ext/oci8/tests/drcp_connect1.phpt @@ -0,0 +1,86 @@ +--TEST-- +DRCP: oci_connect() +--SKIPIF-- + +--INI-- +oci8.connection_class=test +oci8.old_oci_close_semantics=0 +--FILE-- + +--EXPECTF-- +resource(%d) of type (oci8 connection) + This is with OCI_CONNECT..... + The value of the package variable is 0 + Package variable value set to 1000 + Connection conn1 closed.... +resource(%d) of type (oci8 connection) + Select with connection 2 + The value of the package variable is 0 + Package variable value set to 100 +resource(%d) of type (oci8 connection) + Select with connection 3 + The value of the package variable is 100 + + This is with oci_pconnect()..... +resource(%d) of type (oci8 persistent connection) + Package variable value set to 1000 + Connection pconn1 closed.... +resource(%d) of type (oci8 persistent connection) + Select with persistent connection 2 + The value of the package variable is 1000 +Done + diff --git a/ext/oci8/tests/drcp_functions.inc b/ext/oci8/tests/drcp_functions.inc new file mode 100644 index 0000000000..26adb21f35 --- /dev/null +++ b/ext/oci8/tests/drcp_functions.inc @@ -0,0 +1,93 @@ + diff --git a/ext/oci8/tests/drcp_newconnect.phpt b/ext/oci8/tests/drcp_newconnect.phpt new file mode 100644 index 0000000000..79718f4ee2 --- /dev/null +++ b/ext/oci8/tests/drcp_newconnect.phpt @@ -0,0 +1,43 @@ +--TEST-- +DRCP: oci_new_connect() +--SKIPIF-- + +--INI-- +oci8.connection_class=test +oci8.old_oci_close_semantics=0 +--FILE-- + +--EXPECTF-- +resource(%d) of type (oci8 connection) +resource(%d) of type (oci8 connection) +First and second connections are different OK +Done + diff --git a/ext/oci8/tests/drcp_pconn_close1.phpt b/ext/oci8/tests/drcp_pconn_close1.phpt new file mode 100644 index 0000000000..a9b912b26f --- /dev/null +++ b/ext/oci8/tests/drcp_pconn_close1.phpt @@ -0,0 +1,44 @@ +--TEST-- +DRCP: oci_pconnect() with oci_close() and oci8.old_oci_close_semantics ON +--SKIPIF-- + +--INI-- +oci8.old_oci_close_semantics=1 +oci8.connection_class=test +--FILE-- + +--EXPECTF-- +This is with a OCI_PCONNECT +resource(%d) of type (oci8 persistent connection) +resource(%d) of type (oci8 persistent connection) +Both connections share a resource : OK +Done diff --git a/ext/oci8/tests/drcp_pconn_close2.phpt b/ext/oci8/tests/drcp_pconn_close2.phpt new file mode 100644 index 0000000000..5fd2c2355f --- /dev/null +++ b/ext/oci8/tests/drcp_pconn_close2.phpt @@ -0,0 +1,46 @@ +--TEST-- +DRCP: oci_pconnect() with oci_close() and oci8.old_oci_close_semantics OFF +--SKIPIF-- + +--INI-- +oci8.old_oci_close_semantics=0 +oci8.connection_class=test +--FILE-- + +--EXPECTF-- +This is with a OCI_PCONNECT +resource(%d) of type (oci8 persistent connection) +resource(%d) of type (oci8 persistent connection) +Both connections are different : OK +Done diff --git a/ext/oci8/tests/drcp_privileged.phpt b/ext/oci8/tests/drcp_privileged.phpt new file mode 100644 index 0000000000..9af20625ed --- /dev/null +++ b/ext/oci8/tests/drcp_privileged.phpt @@ -0,0 +1,47 @@ +--TEST-- +DRCP: privileged connect +--SKIPIF-- + +--INI-- +oci8.privileged_connect=1 +--FILE-- + +--EXPECTF-- +Warning: oci_connect(): ORA-01031: insufficient privileges in %s on line %d +bool(false) + +Warning: oci_connect(): ORA-01031: insufficient privileges in %s on line %d +bool(false) + +Warning: oci_new_connect(): ORA-01031: insufficient privileges in %s on line %d +bool(false) + +Warning: oci_new_connect(): ORA-01031: insufficient privileges in %s on line %d +bool(false) + +Warning: oci_pconnect(): ORA-01031: insufficient privileges in %s on line %d +bool(false) + +Warning: oci_pconnect(): ORA-01031: insufficient privileges in %s on line %d +bool(false) +Done + diff --git a/ext/oci8/tests/drcp_scope1.phpt b/ext/oci8/tests/drcp_scope1.phpt new file mode 100644 index 0000000000..57f1abe327 --- /dev/null +++ b/ext/oci8/tests/drcp_scope1.phpt @@ -0,0 +1,92 @@ +--TEST-- +DRCP: oci_new_connect() and oci_connect() with scope end when oci8.old_oci_close_semantics ON +--SKIPIF-- + +--INI-- +oci8.old_oci_close_semantics=1 +--FILE-- + +--EXPECTF-- +This is with a OCI_NEW_CONNECT +resource(%d) of type (oci8 connection) +Update done-- DEPT value has been set to NEWDEPT +resource(%d) of type (oci8 connection) +The value of DEPT for id 105 is HR + + +This is with a OCI_CONNECT +resource(%d) of type (oci8 connection) +Update done-- DEPT value has been set to NEWDEPT +resource(%d) of type (oci8 connection) +The value of DEPT for id 105 is HR +Done diff --git a/ext/oci8/tests/drcp_scope2.phpt b/ext/oci8/tests/drcp_scope2.phpt new file mode 100644 index 0000000000..b72e00dbb0 --- /dev/null +++ b/ext/oci8/tests/drcp_scope2.phpt @@ -0,0 +1,91 @@ +--TEST-- +DRCP: oci_new_connect() and oci_connect with scope end when oci8.old_oci_close_semantics OFF +--SKIPIF-- + +--INI-- +oci8.old_oci_close_semantics=0 +--FILE-- + +--EXPECTF-- +This is with a OCI_NEW_CONNECT +resource(%d) of type (oci8 connection) +Update done-- DEPT value has been set to NEWDEPT +resource(%d) of type (oci8 connection) +The value of DEPT for id 105 is HR + + +This is with a OCI_CONNECT +resource(%d) of type (oci8 connection) +Update done-- DEPT value has been set to NEWDEPT +resource(%d) of type (oci8 connection) +The value of DEPT for id 105 is HR +Done 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-- + +--INI-- +oci8.old_oci_close_semantics=1 +--FILE-- + +--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..182704b670 --- /dev/null +++ b/ext/oci8/tests/drcp_scope4.phpt @@ -0,0 +1,62 @@ +--TEST-- +DRCP: oci_pconnect() with scope end when oci8.old_oci_close_semantics OFF +--SKIPIF-- + +--INI-- +oci8.old_oci_close_semantics=0 +--FILE-- + +--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 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-- + +--INI-- +oci8.old_oci_close_semantics=1 +--FILE-- + +--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/lob_042.phpt b/ext/oci8/tests/lob_042.phpt index d79b4846ee..25309d6fc0 100644 --- a/ext/oci8/tests/lob_042.phpt +++ b/ext/oci8/tests/lob_042.phpt @@ -5,8 +5,6 @@ Check various LOB error messages --FILE-- + --FILE-- --FILE-- @@ -27,34 +28,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[1]; /* 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[1]; /* 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[1]; /* resource number */ +$rn3 = (int)$c3; // Connections should differ if ($rn1 == $rn2) { @@ -76,10 +62,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 a31843cfd0..49c21dd341 100644 --- a/ext/oci8/tests/password_new.phpt +++ b/ext/oci8/tests/password_new.phpt @@ -1,7 +1,25 @@ --TEST-- oci_password_change() --SKIPIF-- - + 10/', $phpinfo); + if ($iv === 1) { + die ("skip test known to fail using Oracle 10gR2 client libs connecting to Oracle 11.1 (6277160)"); + } +} +?> --FILE-- + 10/', $phpinfo); + if ($iv === 1) { + die ("skip test known to fail using Oracle 10gR2 client libs connecting to Oracle 11.1 (6277160)"); + } +} +?> --FILE-- --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 1a44e4494f..4c6aa4f1c9 100644 --- a/ext/oci8/tests/pecl_bug10194_blob.phpt +++ b/ext/oci8/tests/pecl_bug10194_blob.phpt @@ -1,19 +1,22 @@ --TEST-- PECL Bug #10194 (segfault in Instant Client when memory_limit is reached inside the callback) --SKIPIF-- - + --INI-- -memory_limit=10M +memory_limit=3M --FILE-- load())); /* here it should fail */ @@ -44,4 +49,6 @@ require dirname(__FILE__).'/drop_table.inc'; echo "Done\n"; ?> --EXPECTF-- +Before load() + Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d diff --git a/ext/oci8/tests/pecl_bug10194_blob_64.phpt b/ext/oci8/tests/pecl_bug10194_blob_64.phpt new file mode 100644 index 0000000000..433d586a4e --- /dev/null +++ b/ext/oci8/tests/pecl_bug10194_blob_64.phpt @@ -0,0 +1,54 @@ +--TEST-- +PECL Bug #10194 (segfault in Instant Client when memory_limit is reached inside the callback) +--SKIPIF-- + +--INI-- +memory_limit=6M +--FILE-- +write($string); +} + +oci_commit($c); + +$ora_sql = "SELECT blob FROM ".$schema.$table_name; +$statement = oci_parse($c,$ora_sql); +oci_execute($statement); + +echo "Before load()\n"; + +$row = oci_fetch_assoc($statement); +var_dump(strlen($row['BLOB']->load())); /* here it should fail */ + +require dirname(__FILE__).'/drop_table.inc'; + +echo "Done\n"; +?> +--EXPECTF-- +Before load() + +Fatal error: Allowed memory size of %d bytes exhausted%s(tried to allocate %d bytes) in %s on line %d diff --git a/ext/oci8/tests/testping.phpt b/ext/oci8/tests/testping.phpt new file mode 100644 index 0000000000..a0d65a30c3 --- /dev/null +++ b/ext/oci8/tests/testping.phpt @@ -0,0 +1,25 @@ +--TEST-- +Exercise OCIPing functionality on reconnect (code coverage test) +--SKIPIF-- + +--INI-- +oci8.ping_interval=0 +--FILE-- + +--EXPECTF-- +Done