null_byte_3.phpt 905 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. --TEST--
  2. Null bytes in SQL statements
  3. --SKIPIF--
  4. <?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
  5. --INI--
  6. display_errors = On
  7. error_reporting = E_WARNING
  8. --FILE--
  9. <?php
  10. require(dirname(__FILE__).'/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. ===DONE===
  24. <?php exit(0); ?>
  25. --EXPECTF--
  26. Test 1: Invalid use of a null byte
  27. Warning: oci_execute(): ORA-00942: %s in %snull_byte_3.php on line %d
  28. Test 2: Using a null byte in a bind variable value causing WHERE clause to fail
  29. array(1) {
  30. ["DUMMY"]=>
  31. array(0) {
  32. }
  33. }
  34. ===DONE===