diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2018-10-13 12:15:58 +0200 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2018-10-13 12:15:58 +0200 |
commit | 87392eff1a3b06cad2449dca8dc90942f3721900 (patch) | |
tree | 970dc65c3ad435c63052a652763ae7bfaa7d24e5 | |
parent | be2ddc6b6575da0b8e7ed235464f7e23c71674c7 (diff) | |
download | php-git-87392eff1a3b06cad2449dca8dc90942f3721900.tar.gz |
Require SQLite ≥ 3.5.0 for ext/sqlite3 and ext/pdo_sqlite
It is possible to pass flags when opening an SQLite database. For
Sqlite < 3.5.0 these are ignored, since `sqlite3_open` doesn't support
flags. Neither a warning or notice is raised in this case, nor is this
behavior documented in the PHP manual. Instead of fixing it either
way, we lift the requirement to SQLite 3.5.0 (released on 2007-09-04)
instead of the former SQLite 3.3.9 (released on 2007-01-04).
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | UPGRADING | 2 | ||||
-rw-r--r-- | ext/pdo_sqlite/config.m4 | 4 | ||||
-rw-r--r-- | ext/pdo_sqlite/sqlite_driver.c | 4 | ||||
-rw-r--r-- | ext/sqlite3/config0.m4 | 6 | ||||
-rw-r--r-- | ext/sqlite3/sqlite3.c | 4 |
6 files changed, 8 insertions, 14 deletions
@@ -24,9 +24,11 @@ PHP NEWS - PDO_SQLite: . Implemented sqlite_stmt_readonly in PDO_SQLite. (BohwaZ) + . Lifted requirements to SQLite 3.5.0. (cmb) - SQLite3: . Unbundled libsqlite. (cmb) + . Lifted requirements to SQLite 3.5.0. (cmb) - Standard: . Fixed bug #74764 (Bindto IPv6 works with file_get_contents but fails with @@ -112,7 +112,7 @@ PHP 7.4 UPGRADE NOTES - SQLite3: . The bundled libsqlite has been removed. To build the SQLite3 and/or - PDO_SQLite extensions a system libsqlite3 ≥ 3.3.9 is now required. + PDO_SQLite extensions a system libsqlite3 ≥ 3.5.0 is now required. - Zip: . The bundled libzip library has been removed. A system libzip >= 0.11 is now diff --git a/ext/pdo_sqlite/config.m4 b/ext/pdo_sqlite/config.m4 index cb3e7d5afc..201f9f24bf 100644 --- a/ext/pdo_sqlite/config.m4 +++ b/ext/pdo_sqlite/config.m4 @@ -52,14 +52,14 @@ if test "$PHP_PDO_SQLITE" != "no"; then PHP_ADD_INCLUDE($PDO_SQLITE_DIR/include) LIBNAME=sqlite3 - LIBSYMBOL=sqlite3_open + LIBSYMBOL=sqlite3_open_v2 PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL, [ PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $PDO_SQLITE_DIR/$PHP_LIBDIR, PDO_SQLITE_SHARED_LIBADD) AC_DEFINE(HAVE_PDO_SQLITELIB,1,[ ]) ],[ - AC_MSG_ERROR([wrong sqlite lib version or lib not found]) + AC_MSG_ERROR([wrong sqlite lib version (< 3.5.0) or lib not found]) ],[ -L$PDO_SQLITE_DIR/$PHP_LIBDIR -lm ]) diff --git a/ext/pdo_sqlite/sqlite_driver.c b/ext/pdo_sqlite/sqlite_driver.c index 2cc7f72475..811f43c268 100644 --- a/ext/pdo_sqlite/sqlite_driver.c +++ b/ext/pdo_sqlite/sqlite_driver.c @@ -809,11 +809,7 @@ static int pdo_sqlite_handle_factory(pdo_dbh_t *dbh, zval *driver_options) /* {{ flags = pdo_attr_lval(driver_options, PDO_SQLITE_ATTR_OPEN_FLAGS, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE); -#if SQLITE_VERSION_NUMBER >= 3005000 i = sqlite3_open_v2(filename, &H->db, flags, NULL); -#else - i = sqlite3_open(filename, &H->db); -#endif efree(filename); diff --git a/ext/sqlite3/config0.m4 b/ext/sqlite3/config0.m4 index 6d6fb88f55..98495da300 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.3.9+]) - PHP_CHECK_LIBRARY(sqlite3, sqlite3_prepare_v2, [ + AC_MSG_CHECKING([for SQLite 3.5.0+]) + PHP_CHECK_LIBRARY(sqlite3, sqlite3_open_v2, [ 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.3.9 first or check libsqlite3 is present]) + AC_MSG_ERROR([Please install SQLite 3.5.0 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 c91aec17cd..2abf99f4eb 100644 --- a/ext/sqlite3/sqlite3.c +++ b/ext/sqlite3/sqlite3.c @@ -131,11 +131,7 @@ PHP_METHOD(sqlite3, open) fullpath = filename; } -#if SQLITE_VERSION_NUMBER >= 3005000 rc = sqlite3_open_v2(fullpath, &(db_obj->db), flags, NULL); -#else - rc = sqlite3_open(fullpath, &(db_obj->db)); -#endif if (rc != SQLITE_OK) { zend_throw_exception_ex(zend_ce_exception, 0, "Unable to open database: %s", #ifdef HAVE_SQLITE3_ERRSTR |