1--TEST-- 2Null bytes in SQL statements 3--EXTENSIONS-- 4oci8 5--SKIPIF-- 6<?php 7$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs 8require(__DIR__.'/skipif.inc'); 9?> 10--INI-- 11display_errors = On 12error_reporting = E_WARNING 13--FILE-- 14<?php 15 16require(__DIR__.'/connect.inc'); 17 18// Run Test 19 20echo "Test 1: Valid use of a null byte\n"; 21 22$s = oci_parse($c, "select * \0from dual"); 23oci_execute($s); 24oci_fetch_all($s, $res); 25var_dump($res); 26 27echo "Test 3: Using a null byte in a bind variable name\n"; 28 29$s = oci_parse($c, "select * from dual where :bv = 1"); 30$bv = 1; 31oci_bind_by_name($s, ":bv\0:bv", $bv); 32oci_execute($s); 33 34 35?> 36--EXPECTF-- 37Test 1: Valid use of a null byte 38array(1) { 39 ["DUMMY"]=> 40 array(1) { 41 [0]=> 42 string(1) "X" 43 } 44} 45Test 3: Using a null byte in a bind variable name 46 47Warning: oci_bind_by_name(): ORA-01036: %s in %snull_byte_2.php on line %d 48 49Warning: oci_execute(): ORA-01008: %s in %snull_byte_2.php on line %d 50