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