]> granicus.if.org Git - php/commitdiff
Require SQLite ≥ 3.7.4 for ext/sqlite3
authorChristoph M. Becker <cmbecker69@gmx.de>
Thu, 29 Nov 2018 14:10:39 +0000 (15:10 +0100)
committerChristoph M. Becker <cmbecker69@gmx.de>
Thu, 29 Nov 2018 14:10:39 +0000 (15:10 +0100)
`SQLite3::readOnly()` uses `sqlite3_stmt_readonly()` which is only
available as of libsqlite 3.7.4.  For older SQLite3 versions we return
always `false`, which can be confusing.  Instead of sticking with this
behavior, or even undefining the method for old SQLite3 versions, we
lift the requirements to SQLite 3.7.4 (released on 2010-12-08),
according to a respective discussion[1].

Since pdo_sqlite doesn't use `sqlite3_stmt_readonly()`, we stick with
the minimum requirement of SQLite 3.5.0.

[1] <https://github.com/php/php-src/pull/3614>

NEWS
UPGRADING
ext/sqlite3/config0.m4
ext/sqlite3/sqlite3.c

diff --git a/NEWS b/NEWS
index 1795b052dc2ad3e43562feb9c20355fcb5abaaf9..e2a92559f8e79c09adfa75031d0e3e486bf21099 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -41,7 +41,7 @@ PHP                                                                        NEWS
 
 - SQLite3:
   . Unbundled libsqlite. (cmb)
-  . Lifted requirements to SQLite 3.5.0. (cmb)
+  . Lifted requirements to SQLite 3.7.4. (cmb)
   . Forbid (un)serialization of SQLite3, SQLite3Stmt and SQLite3Result. (cmb)
   . Added support for the SQLite @name notation. (cmb, BohwaZ)
 
index 9016b4a1d36c7ef3973c69b587fb8ff42df2bdba..dc081a6b6c5c36b1d99d651225b3aae99914c2f0 100644 (file)
--- a/UPGRADING
+++ b/UPGRADING
@@ -135,8 +135,9 @@ PHP 7.4 UPGRADE NOTES
     Use corresponding constants instead (e.g. ReflectionMethod::IS_PUBLIC).
 
 - SQLite3:
-  . The bundled libsqlite has been removed.  To build the SQLite3 and/or
-    PDO_SQLite extensions a system libsqlite3 ≥ 3.5.0 is now required.
+  . The bundled libsqlite has been removed.  To build the SQLite3 extension
+    a system libsqlite3 ≥ 3.7.4 is now required. To build the PDO_SQLite
+    extension a system libsqlite3 ≥ 3.5.0 is now required.
   . (Un)serialization of SQLite3, SQLite3Stmt and SQLite3Result is now explictly
     forbidden. Formerly, serialization of instances of these classes was
     possible, but unserialization yielded unusable objects.
index 98495da30046cd567881683f31a3253604ffe273..24a4df02773e941348d0d676cda8dafdfb8a45ff 100644 (file)
@@ -33,14 +33,14 @@ if test $PHP_SQLITE3 != "no"; then
     AC_MSG_ERROR([Please reinstall the sqlite distribution from http://www.sqlite.org])
   fi
 
-  AC_MSG_CHECKING([for SQLite 3.5.0+])
-  PHP_CHECK_LIBRARY(sqlite3, sqlite3_open_v2, [
+  AC_MSG_CHECKING([for SQLite 3.7.4+])
+  PHP_CHECK_LIBRARY(sqlite3, sqlite3_stmt_readonly, [
     AC_MSG_RESULT(found)
     PHP_ADD_LIBRARY_WITH_PATH(sqlite3, $SQLITE3_DIR/$PHP_LIBDIR, SQLITE3_SHARED_LIBADD)
     PHP_ADD_INCLUDE($SQLITE3_DIR/include)
   ],[
     AC_MSG_RESULT([not found])
-    AC_MSG_ERROR([Please install SQLite 3.5.0 first or check libsqlite3 is present])
+    AC_MSG_ERROR([Please install SQLite 3.7.4 first or check libsqlite3 is present])
   ],[
     -L$SQLITE3_DIR/$PHP_LIBDIR -lm
   ])
index 7f76e55684fd8f1c206e83e76d526e67be16590c..58d8cf2791224c9ffd8f50f80cbf8a8e2369b62e 100644 (file)
@@ -1386,11 +1386,9 @@ PHP_METHOD(sqlite3stmt, readOnly)
        SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3);
        SQLITE3_CHECK_INITIALIZED_STMT(stmt_obj->stmt, SQLite3Stmt);
 
-#if SQLITE_VERSION_NUMBER >= 3007004
        if (sqlite3_stmt_readonly(stmt_obj->stmt)) {
                RETURN_TRUE;
        }
-#endif
        RETURN_FALSE;
 }
 /* }}} */