1--TEST--
2SQLite3::open error test
3--EXTENSIONS--
4sqlite3
5--SKIPIF--
6<?php
7if(substr(PHP_OS, 0, 3) == 'WIN' ) {
8    die('skip non windows test');
9}
10if (!function_exists('posix_geteuid')) {
11    die('SKIP posix_geteuid() not defined so cannot check if run as root');
12}
13if (posix_geteuid() == 0) {
14    die('SKIP Cannot run test as root.');
15}
16?>
17--FILE--
18<?php
19$unreadable = __DIR__ . '/unreadable.db';
20touch($unreadable);
21chmod($unreadable,  0200);
22try {
23    $db = new SQLite3($unreadable);
24} catch (Exception $e) {
25    echo $e . "\n";
26}
27echo "Done\n";
28unlink($unreadable);
29?>
30--EXPECTF--
31Exception: Unable to open database: %s in %ssqlite3_15_open_error.php:%d
32Stack trace:
33#0 %ssqlite3_15_open_error.php(%d): SQLite3->__construct('%s')
34#1 {main}
35Done
36