null_byte_2.phpt 1008 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. require(dirname(__FILE__).'/connect.inc');
  14. // Run Test
  15. echo "Test 1: Valid use of a null byte\n";
  16. $s = oci_parse($c, "select * \0from dual");
  17. oci_execute($s);
  18. oci_fetch_all($s, $res);
  19. var_dump($res);
  20. echo "Test 3: Using a null byte in a bind variable name\n";
  21. $s = oci_parse($c, "select * from dual where :bv = 1");
  22. $bv = 1;
  23. oci_bind_by_name($s, ":bv\0:bv", $bv);
  24. oci_execute($s);
  25. ?>
  26. ===DONE===
  27. <?php exit(0); ?>
  28. --EXPECTF--
  29. Test 1: Valid use of a null byte
  30. array(1) {
  31. ["DUMMY"]=>
  32. array(1) {
  33. [0]=>
  34. string(1) "X"
  35. }
  36. }
  37. Test 3: Using a null byte in a bind variable name
  38. Warning: oci_bind_by_name(): ORA-01036: %s in %snull_byte_2.php on line %d
  39. Warning: oci_execute(): ORA-01008: %s in %snull_byte_2.php on line %d
  40. ===DONE===