1--TEST-- 2Null bytes in SQL statements 3--SKIPIF-- 4<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?> 5--INI-- 6display_errors = On 7error_reporting = E_WARNING 8--FILE-- 9<?php 10 11require(dirname(__FILE__).'/connect.inc'); 12 13// Run Test 14 15echo "Test 1: Invalid use of a null byte\n"; 16 17$s = oci_parse($c, "select * from du\0al"); 18oci_execute($s); 19 20echo "Test 2: Using a null byte in a bind variable value causing WHERE clause to fail\n"; 21 22$s = oci_parse($c, "select * from dual where :bv = 'abc'"); 23$bv = 'abc\0abc'; 24oci_bind_by_name($s, ":bv", $bv); 25oci_execute($s); 26oci_fetch_all($s, $res); 27var_dump($res); 28 29?> 30===DONE=== 31<?php exit(0); ?> 32--EXPECTF-- 33Test 1: Invalid use of a null byte 34 35Warning: oci_execute(): ORA-00942: %s in %snull_byte_3.php on line %d 36Test 2: Using a null byte in a bind variable value causing WHERE clause to fail 37array(1) { 38 ["DUMMY"]=> 39 array(0) { 40 } 41} 42===DONE=== 43