null_byte_3.phpt 792 B

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