null_byte_2.phpt 966 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. --TEST--
  2. Null bytes in SQL statements
  3. --EXTENSIONS--
  4. oci8
  5. --SKIPIF--
  6. <?php
  7. $target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
  8. require(__DIR__.'/skipif.inc');
  9. ?>
  10. --INI--
  11. display_errors = On
  12. error_reporting = E_WARNING
  13. --FILE--
  14. <?php
  15. require(__DIR__.'/connect.inc');
  16. // Run Test
  17. echo "Test 1: Valid use of a null byte\n";
  18. $s = oci_parse($c, "select * \0from dual");
  19. oci_execute($s);
  20. oci_fetch_all($s, $res);
  21. var_dump($res);
  22. echo "Test 3: Using a null byte in a bind variable name\n";
  23. $s = oci_parse($c, "select * from dual where :bv = 1");
  24. $bv = 1;
  25. oci_bind_by_name($s, ":bv\0:bv", $bv);
  26. oci_execute($s);
  27. ?>
  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