1--TEST-- 2Bug #51291 (oci_error() doesn't report last error when called two times) 3--EXTENSIONS-- 4oci8 5--SKIPIF-- 6<?php 7require_once 'skipifconnectfailure.inc'; 8$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs: different error messages from TimesTen 9require __DIR__.'/skipif.inc'; 10?> 11--FILE-- 12<?php 13 14require __DIR__.'/connect.inc'; 15 16echo "\nTest 1 - Execute - after successful 2nd query with same statement\n"; 17 18$s = oci_parse($c, "declare e exception; begin if :bv = 1 then raise e; end if; end;"); 19$bv = 1; 20oci_bind_by_name($s, ":bv", $bv); 21$r = @oci_execute($s, OCI_DEFAULT); 22if (!$r) { 23 var_dump(oci_error(), oci_error($c), oci_error($s)); 24 $bv = 0; 25 $r = oci_execute($s, OCI_DEFAULT); 26 echo "Execute status is "; 27 if (is_null($r)) echo "null"; 28 else if ($r === false) echo "false"; 29 else if ($r === true) echo "true"; 30 else echo $r; 31 echo "\n"; 32 echo "2nd call after successful execute\n"; 33 var_dump(oci_error(), oci_error($c), oci_error($s)); 34} 35 36?> 37--EXPECTF-- 38Test 1 - Execute - after successful 2nd query with same statement 39bool(false) 40bool(false) 41array(4) { 42 ["code"]=> 43 int(6510) 44 ["message"]=> 45 string(72) "ORA-06510: PL/SQL: %s 46ORA-06512: %s" 47 ["offset"]=> 48 int(0) 49 ["sqltext"]=> 50 string(64) "declare e exception; begin if :bv = 1 then raise e; end if; end;" 51} 52Execute status is true 532nd call after successful execute 54bool(false) 55bool(false) 56bool(false) 57