xref: /PHP-8.1/ext/oci8/tests/null_byte_3.phpt (revision 74859783)
1--TEST--
2Null bytes in SQL statements
3--EXTENSIONS--
4oci8
5--INI--
6display_errors = On
7error_reporting = E_WARNING
8--FILE--
9<?php
10
11require(__DIR__.'/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--EXPECTF--
31Test 1: Invalid use of a null byte
32
33Warning: oci_execute(): ORA-00942: %s in %snull_byte_3.php on line %d
34Test 2: Using a null byte in a bind variable value causing WHERE clause to fail
35array(1) {
36  ["DUMMY"]=>
37  array(0) {
38  }
39}
40