2008-07-25 10:44:59 +08:00
--TEST--
2010-04-27 07:55:03 +08:00
SQLite3 open_basedir checks
2008-07-25 10:44:59 +08:00
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--INI--
open_basedir=.
--FILE--
<?php
$directory = dirname(__FILE__) . '/';
$file = uniqid() . '.db';
echo "Within test directory\n";
$db = new SQLite3($directory . $file);
var_dump($db);
var_dump($db->close());
unlink($directory . $file);
echo "Above test directory\n";
2009-02-10 08:24:33 +08:00
try {
$db = new SQLite3('../bad' . $file);
} catch (Exception $e) {
echo $e . "\n";
}
2008-07-25 10:44:59 +08:00
echo "Done\n";
?>
--EXPECTF--
Within test directory
object(SQLite3)#%d (0) {
}
bool(true)
Above test directory
2009-05-23 02:27:38 +08:00
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
exception 'Exception' with message 'open_basedir prohibits opening %s' in %ssqlite3_21_security.php:%d
2009-02-10 08:24:33 +08:00
Stack trace:
2009-05-23 02:27:38 +08:00
#0 %ssqlite3_21_security.php(%d): SQLite3->__construct('%s')
2009-02-10 08:24:33 +08:00
#1 {main}
2008-07-25 10:44:59 +08:00
Done