php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login

Patch ignore-open-create-with-open-readonly for SQLite related Bug #74883

Patch version 2017-07-08 21:42 UTC

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

Developer: jeroen@treurniet.us

diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c
index 04c98d8..f2e24dd 100644
--- a/ext/sqlite3/sqlite3.c
+++ b/ext/sqlite3/sqlite3.c
@@ -132,6 +132,10 @@ PHP_METHOD(sqlite3, open)
 		fullpath = filename;
 	}
 
+	if ((flags & SQLITE_OPEN_READONLY) && (flags & SQLITE_OPEN_CREATE)) {
+		flags = flags & ~SQLITE_OPEN_CREATE;
+	}
+
 #if SQLITE_VERSION_NUMBER >= 3005000
 	if (sqlite3_open_v2(fullpath, &(db_obj->db), flags, NULL) != SQLITE_OK) {
 #else
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC