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