1--TEST-- 2Oracle Database 12c Implicit Result Sets: oci_get_implicit_resultset: oci_free_statement #1 3--EXTENSIONS-- 4oci8 5--SKIPIF-- 6<?php 7require_once 'skipifconnectfailure.inc'; 8$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs 9require __DIR__.'/skipif.inc'; 10preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); 11if (!(isset($matches[0]) && $matches[1] >= 12)) { 12 die("skip expected output only valid when using Oracle Database 12c or greater"); 13} 14preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); 15if (!(isset($matches[0]) && $matches[0] >= 12)) { 16 die("skip works only with Oracle 12c or greater version of Oracle client libraries"); 17} 18?> 19--FILE-- 20<?php 21 22require __DIR__.'/connect.inc'; 23 24// Initialization 25 26$plsql = 27 "declare 28 c1 sys_refcursor; 29 begin 30 open c1 for select 1 from dual union all select 2 from dual; 31 dbms_sql.return_result(c1); 32 open c1 for select 3 from dual union all select 4 from dual; 33 dbms_sql.return_result(c1); 34 open c1 for select 5 from dual union all select 6 from dual; 35 dbms_sql.return_result(c1); 36 end;"; 37 38// Run Test 39 40echo "Test 1\n"; 41 42$s = oci_parse($c, $plsql); 43oci_execute($s); 44 45try { 46 while (($s1 = oci_get_implicit_resultset($s))) { 47 while (($row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS)) != false) { 48 foreach ($row as $item) { 49 echo " ".$item; 50 } 51 echo "\n"; 52 oci_free_statement($s1); // Free the implicit result handle 53 } 54 } 55 oci_free_statement($s); 56} catch(\TypeError $exception) { 57 var_dump($exception->getMessage()); 58} 59 60?> 61--EXPECTF-- 62Test 1 63 1 64string(%d) "oci_fetch_array(): supplied resource is not a valid oci8 statement resource"