You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
941 B

  1. --TEST--
  2. SQLite3 open_basedir / safe_mode checks
  3. --SKIPIF--
  4. <?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
  5. --INI--
  6. open_basedir=.
  7. --FILE--
  8. <?php
  9. $directory = dirname(__FILE__) . '/';
  10. $file = uniqid() . '.db';
  11. echo "Within test directory\n";
  12. $db = new SQLite3($directory . $file);
  13. var_dump($db);
  14. var_dump($db->close());
  15. unlink($directory . $file);
  16. echo "Above test directory\n";
  17. try {
  18. $db = new SQLite3('../bad' . $file);
  19. } catch (Exception $e) {
  20. echo $e . "\n";
  21. }
  22. echo "Done\n";
  23. ?>
  24. --EXPECTF--
  25. Within test directory
  26. object(SQLite3)#%d (0) {
  27. }
  28. bool(true)
  29. Above test directory
  30. Warning: SQLite3::__construct(): open_basedir restriction in effect. File(%s) is not within the allowed path(s): (.) in %ssqlite3_21_security.php on line %d
  31. exception 'Exception' with message 'open_basedir prohibits opening %s' in %ssqlite3_21_security.php:%d
  32. Stack trace:
  33. #0 %ssqlite3_21_security.php(%d): SQLite3->__construct('%s')
  34. #1 {main}
  35. Done