1--TEST--
2SQLite3::open error test
3--SKIPIF--
4<?php
5if(substr(PHP_OS, 0, 3) != 'WIN' ) {
6	die('skip windows only test');
7}
8require_once(__DIR__ . '/skipif.inc');
9?>
10--FILE--
11<?php
12$sysroot = exec('echo %systemroot%');
13$icacls = "$sysroot\\System32\\icacls.exe";
14$user = get_current_user();
15$unreadable = __DIR__ . '/unreadable.db';
16
17touch($unreadable);
18$cmd = $icacls . ' ' . $unreadable . ' /inheritance:r /deny ' . $user . ':(F,M,R,RX,W)';
19exec($cmd);
20
21try {
22	$db = new SQLite3($unreadable);
23} catch (Exception $e) {
24	echo $e . "\n";
25}
26echo "Done\n";
27
28$cmd = $icacls . ' ' . $unreadable . ' /grant ' . $user . ':(F,M,R,RX,W)';
29exec($cmd);
30unlink($unreadable);
31?>
32--EXPECTF--
33Exception: Unable to open database: %s in %ssqlite3_15_open_error-win.php:%d
34Stack trace:
35#0 %ssqlite3_15_open_error-win.php(%d): SQLite3->__construct('%s')
36#1 {main}
37Done
38