From a757ebb5b58db9e15b71ed50c6ba9e2a5111508c Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Thu, 29 Nov 2018 15:10:39 +0100 Subject: [PATCH] =?utf8?q?Require=20SQLite=20=E2=89=A5=203.7.4=20for=20ext?= =?utf8?q?/sqlite3?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit `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] --- NEWS | 2 +- UPGRADING | 5 +++-- ext/sqlite3/config0.m4 | 6 +++--- ext/sqlite3/sqlite3.c | 2 -- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/NEWS b/NEWS index 1795b052dc..e2a92559f8 100644 --- 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) diff --git a/UPGRADING b/UPGRADING index 9016b4a1d3..dc081a6b6c 100644 --- 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. diff --git a/ext/sqlite3/config0.m4 b/ext/sqlite3/config0.m4 index 98495da300..24a4df0277 100644 --- a/ext/sqlite3/config0.m4 +++ b/ext/sqlite3/config0.m4 @@ -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 ]) diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index 7f76e55684..58d8cf2791 100644 --- a/ext/sqlite3/sqlite3.c +++ b/ext/sqlite3/sqlite3.c @@ -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; } /* }}} */ -- 2.49.0