1--TEST-- 2Test some more oci_bind_by_name error conditions 3--SKIPIF-- 4<?php 5if (!extension_loaded('oci8')) die ("skip no oci8 extension"); 6$target_dbs = array('oracledb' => true, 'timesten' => true); // test runs on these DBs 7require(__DIR__.'/skipif.inc'); 8preg_match('/.*Release ([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)*/', oci_server_version($c), $matches); 9if (!(isset($matches[0]) && $matches[1] >= 12)) { 10 die("skip expected output only valid when using Oracle Database 12c or greater"); 11} 12preg_match('/^[[:digit:]]+/', oci_client_version(), $matches); 13if (!(isset($matches[0]) && $matches[0] >= 12)) { 14 die("skip works only with Oracle 12c or greater version of Oracle client libraries"); 15} 16?> 17--FILE-- 18<?php 19 20require(__DIR__.'/connect.inc'); 21 22// Initialization 23 24$stmtarray = array( 25 "drop table error_bind_2_tab", 26 "create table error_bind_2_tab(name varchar(10))" 27); 28oci8_test_sql_execute($c, $stmtarray); 29 30echo "Test 1 - SQLT_BOL\n"; 31 32unset($name); 33$stmt = oci_parse($c, "insert into error_bind_2_tab values (:name)"); 34oci_bind_by_name($stmt, ":name", $name, -1, SQLT_BOL); 35$name=$c; 36var_dump(oci_execute($stmt)); 37 38echo "Test 2 - SQLT_BOL\n"; 39 40unset($name); 41$stmt = oci_parse($c, "insert into error_bind_2_tab values (:name)"); 42$name=$c; 43oci_bind_by_name($stmt, ":name", $name, -1, SQLT_BOL); 44 45// Clean up 46 47$stmtarray = array( 48 "drop table error_bind_2_tab", 49); 50oci8_test_sql_execute($c, $stmtarray); 51 52echo "Done\n"; 53 54?> 55--EXPECTF-- 56Test 1 - SQLT_BOL 57 58Warning: oci_execute(): Invalid variable used for bind in %s on line %d 59bool(false) 60Test 2 - SQLT_BOL 61 62Warning: oci_bind_by_name(): Invalid variable used for bind in %s on line %d 63Done 64