diff options
author | Christopher Jones <sixd@php.net> | 2010-08-07 00:28:09 +0000 |
---|---|---|
committer | Christopher Jones <sixd@php.net> | 2010-08-07 00:28:09 +0000 |
commit | 05be95c0bee8c215d813ea71e000fa0b76abaf86 (patch) | |
tree | e1f53f5490f30a7c83e79ad929797559deb359e2 /tests/bug43492.phpt | |
download | php-git-oci8-1.4.3.tar.gz |
Tagging the 1.4.3 releaseoci8-1.4.3
Diffstat (limited to 'tests/bug43492.phpt')
-rw-r--r-- | tests/bug43492.phpt | 378 |
1 files changed, 378 insertions, 0 deletions
diff --git a/tests/bug43492.phpt b/tests/bug43492.phpt new file mode 100644 index 0000000000..d28aabfced --- /dev/null +++ b/tests/bug43492.phpt @@ -0,0 +1,378 @@ +--TEST-- +Bug #43492 (Nested cursor leaks) +--SKIPIF-- +<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?> +--FILE-- +<?php + +require dirname(__FILE__).'/connect.inc'; + +$stmtarray = array( + "DROP table bug43492_tab", + "CREATE TABLE bug43492_tab(col1 VARCHAR2(1))", + "INSERT INTO bug43492_tab VALUES ('A')", + "INSERT INTO bug43492_tab VALUES ('B')", + "INSERT INTO bug43492_tab VALUES ('C')", + "INSERT INTO bug43492_tab VALUES ('D')", + "INSERT INTO bug43492_tab VALUES ('E')", + "INSERT INTO bug43492_tab VALUES ('F')", + "INSERT INTO bug43492_tab VALUES ('G')", + "INSERT INTO bug43492_tab VALUES ('H')", + "INSERT INTO bug43492_tab VALUES ('I')", + "INSERT INTO bug43492_tab VALUES ('J')" +); + +foreach ($stmtarray as $stmt) { + $s = oci_parse($c, $stmt); + @oci_execute($s); +} + +/* + +While fetching data from a ref cursor, the parent statement needs to +be around. Also when the parent statement goes out of scope, it is +not automatically released which causes a cursor leak. + +If either or both of the lines marked (*) are removed, then the script +will fail with the error "ORA-01000: maximum open cursors exceeded". + +*/ + +function fetch($c, $i) { + global $s; // (*) Allow parent statement to be available when child is used + $s = ociparse($c, 'select cursor(select * from bug43492_tab) c from bug43492_tab'); + ociexecute($s, OCI_DEFAULT); + ocifetchinto($s, $result, OCI_ASSOC); + ociexecute($result['C'], OCI_DEFAULT); + return $result['C']; +} + +for($i = 0; $i < 300; $i++) { + $cur = fetch($c, $i); + for($j = 0; $j < 10; $j++) { + ocifetchinto($cur, $row, OCI_NUM); + echo "$row[0] "; + } + echo "\n"; + ocifreestatement($cur); + ocifreestatement($s); // (*) Free the parent statement cleanly +} + +echo "Done\n"; + +// Cleanup + +$stmtarray = array( + "DROP table bug43492_tab" +); + +foreach ($stmtarray as $stmt) { + $s = oci_parse($c, $stmt); + @oci_execute($s); +} + +oci_close($c); + +?> +--EXPECT-- +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +A B C D E F G H I J +Done |