php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #61791
Patch sqlite_5.4.diff revision 2012-04-20 20:13 UTC by ab@php.net
Patch sqlite_5.3.diff revision 2012-04-20 20:12 UTC by ab@php.net

Patch sqlite_5.3.diff for SQLite related Bug #61791

Patch version 2012-04-20 20:12 UTC

Return to Bug #61791 | Download this patch
Patch Revisions:

Developer: ab@php.net

diff --git a/ext/sqlite3/tests/sqlite3_15_open_error.phpt b/ext/sqlite3/tests/sqlite3_15_open_error.phpt
index f296f82..9b0496f 100644
--- a/ext/sqlite3/tests/sqlite3_15_open_error.phpt
+++ b/ext/sqlite3/tests/sqlite3_15_open_error.phpt
@@ -2,6 +2,9 @@
 SQLite3::open error test
 --SKIPIF--
 <?php
+if(substr(PHP_OS, 0, 3) == 'WIN' ) {
+	die('skip non windows test');
+}
 require_once(dirname(__FILE__) . '/skipif.inc');
 if (posix_geteuid() == 0) {
     die('SKIP Cannot run test as root.');
--- -	Fri Apr 20 22:05:24 2012
+++ ext/sqlite3/tests/sqlite3_15_open_error-win.phpt	Fri Apr 20 21:05:25 2012
@@ -0,0 +1,36 @@
+--TEST--
+SQLite3::open error test
+--SKIPIF--
+<?php
+if(substr(PHP_OS, 0, 3) != 'WIN' ) {
+	die('skip windows only test');
+}
+require_once(__DIR__ . '/skipif.inc');
+?>
+--FILE--
+<?php
+$icacls = 'c:\\Windows\\System32\\icacls.exe';
+$user = get_current_user();
+$unreadable = __DIR__ . '/unreadable.db';
+
+touch($unreadable);
+$cmd = $icacls . ' ' . $unreadable . ' /inheritance:r /deny ' . $user . ':(F,M,R,RX,W)';
+exec($cmd);
+
+try {
+	$db = new SQLite3($unreadable);
+} catch (Exception $e) {
+	echo $e . "\n";
+}
+echo "Done\n";
+
+$cmd = $icacls . ' ' . $unreadable . ' /grant ' . $user . ':(F,M,R,RX,W)';
+exec($cmd);
+unlink($unreadable);
+?>
+--EXPECTF--
+exception 'Exception' with message 'Unable to open database: %s' in %ssqlite3_15_open_error-win.php:%d
+Stack trace:
+#0 %ssqlite3_15_open_error-win.php(%d): SQLite3->__construct('%s')
+#1 {main}
+Done
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Sep 27 14:03:37 2021 UTC