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