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