Commit 435e67e075e for php.net
commit 435e67e075e25f96866eebc44fd2050c6c57bccf
Author: Peter Kokot <peterkokot@gmail.com>
Date: Wed Feb 11 13:13:18 2026 +0100
Remove HAVE_SQLITE3_{CLOSE_V2,ERRSTR} (#18963)
As of PHP 8.5 the minimum required SQLite library is 3.7.17, and this
removes the following preprocessor macros checks:
- HAVE_SQLITE3_CLOSE_V2 (sqlite3_close_v2() function is available since
SQLite 3.7.14.)
- HAVE_SQLITE3_ERRSTR (sqlite3_errstr() function is available since
SQLite 3.7.15)
- SQLITE_VERSION_NUMBER should be now always greater than 3006011
(3.6.11).
diff --git a/ext/pdo_sqlite/config.m4 b/ext/pdo_sqlite/config.m4
index eaaee6182bf..7b7700481a3 100644
--- a/ext/pdo_sqlite/config.m4
+++ b/ext/pdo_sqlite/config.m4
@@ -9,12 +9,6 @@ if test "$PHP_PDO_SQLITE" != "no"; then
PHP_SETUP_SQLITE([PDO_SQLITE_SHARED_LIBADD])
- PHP_CHECK_LIBRARY([sqlite3], [sqlite3_close_v2],
- [AC_DEFINE([HAVE_SQLITE3_CLOSE_V2], [1],
- [Define to 1 if SQLite library has the 'sqlite3_close_v2' function.])],
- [],
- [$PDO_SQLITE_SHARED_LIBADD])
-
PHP_CHECK_LIBRARY([sqlite3], [sqlite3_column_table_name],
[AC_DEFINE([HAVE_SQLITE3_COLUMN_TABLE_NAME], [1],
[Define to 1 if SQLite library was compiled with the
diff --git a/ext/pdo_sqlite/config.w32 b/ext/pdo_sqlite/config.w32
index d1f94438925..d6162278abe 100644
--- a/ext/pdo_sqlite/config.w32
+++ b/ext/pdo_sqlite/config.w32
@@ -8,7 +8,6 @@ if (PHP_PDO_SQLITE != "no") {
ADD_EXTENSION_DEP('pdo_sqlite', 'pdo');
AC_DEFINE("HAVE_SQLITE3_COLUMN_TABLE_NAME", 1, "Define to 1 if SQLite library was compiled with the SQLITE_ENABLE_COLUMN_METADATA and has the 'sqlite3_column_table_name' function.");
- AC_DEFINE("HAVE_SQLITE3_CLOSE_V2", 1, "Define to 1 if SQLite library has the 'sqlite3_close_v2' function.");
ADD_MAKEFILE_FRAGMENT();
} else {
WARNING("pdo_sqlite not enabled; libraries and/or headers not found");
diff --git a/ext/pdo_sqlite/sqlite_driver.c b/ext/pdo_sqlite/sqlite_driver.c
index 537aefa9be1..5a30d27193e 100644
--- a/ext/pdo_sqlite/sqlite_driver.c
+++ b/ext/pdo_sqlite/sqlite_driver.c
@@ -159,11 +159,7 @@ static void sqlite_handle_closer(pdo_dbh_t *dbh) /* {{{ */
pdo_sqlite_cleanup_callbacks(H);
if (H->db) {
-#ifdef HAVE_SQLITE3_CLOSE_V2
sqlite3_close_v2(H->db);
-#else
- sqlite3_close(H->db);
-#endif
H->db = NULL;
}
if (einfo->errmsg) {
diff --git a/ext/sqlite3/config.w32 b/ext/sqlite3/config.w32
index f99e4eb281d..98b46715d2f 100644
--- a/ext/sqlite3/config.w32
+++ b/ext/sqlite3/config.w32
@@ -7,7 +7,6 @@ if (PHP_SQLITE3 != "no") {
EXTENSION("sqlite3", "sqlite3.c", null, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
AC_DEFINE("HAVE_SQLITE3", 1, "Define to 1 if the PHP extension 'sqlite3' is available.");
- AC_DEFINE("HAVE_SQLITE3_ERRSTR", 1, "Define to 1 if SQLite library has the 'sqlite3_errstr' function.");
AC_DEFINE("HAVE_SQLITE3_EXPANDED_SQL", 1, "Define to 1 if SQLite library has the 'sqlite3_expanded_sql' function.");
} else {
WARNING("sqlite3 not enabled; libraries and/or headers not found");
diff --git a/ext/sqlite3/config0.m4 b/ext/sqlite3/config0.m4
index 453108f692a..ada1e351d43 100644
--- a/ext/sqlite3/config0.m4
+++ b/ext/sqlite3/config0.m4
@@ -9,12 +9,6 @@ if test $PHP_SQLITE3 != "no"; then
AC_DEFINE([HAVE_SQLITE3], [1],
[Define to 1 if the PHP extension 'sqlite3' is available.])
- PHP_CHECK_LIBRARY([sqlite3], [sqlite3_errstr],
- [AC_DEFINE([HAVE_SQLITE3_ERRSTR], [1],
- [Define to 1 if SQLite library has the 'sqlite3_errstr' function.])],
- [],
- [$SQLITE3_SHARED_LIBADD])
-
PHP_CHECK_LIBRARY([sqlite3], [sqlite3_expanded_sql],
[AC_DEFINE([HAVE_SQLITE3_EXPANDED_SQL], [1],
[Define to 1 if SQLite library has the 'sqlite3_expanded_sql' function.])],
diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c
index 6d55409ca45..3d41b2c2c22 100644
--- a/ext/sqlite3/sqlite3.c
+++ b/ext/sqlite3/sqlite3.c
@@ -143,11 +143,7 @@ PHP_METHOD(SQLite3, open)
rc = sqlite3_open_v2(fullpath, &(db_obj->db), flags, NULL);
if (rc != SQLITE_OK) {
zend_throw_exception_ex(zend_ce_exception, 0, "Unable to open database: %s",
-#ifdef HAVE_SQLITE3_ERRSTR
- db_obj->db ? sqlite3_errmsg(db_obj->db) : sqlite3_errstr(rc));
-#else
- db_obj->db ? sqlite3_errmsg(db_obj->db) : "");
-#endif
+ db_obj->db ? sqlite3_errmsg(db_obj->db) : sqlite3_errstr(rc));
sqlite3_close(db_obj->db);
if (fullpath != filename) {
efree(fullpath);
@@ -1329,7 +1325,6 @@ PHP_METHOD(SQLite3, setAuthorizer)
/* }}} */
-#if SQLITE_VERSION_NUMBER >= 3006011
/* {{{ Backups the current database to another one. */
PHP_METHOD(SQLite3, backup)
{
@@ -1383,7 +1378,6 @@ PHP_METHOD(SQLite3, backup)
RETURN_TRUE;
}
/* }}} */
-#endif
/* {{{ Returns the number of parameters within the prepared statement. */
PHP_METHOD(SQLite3Stmt, paramCount)
diff --git a/ext/sqlite3/sqlite3.stub.php b/ext/sqlite3/sqlite3.stub.php
index 54a7b41ec55..1a51f9dc3d8 100644
--- a/ext/sqlite3/sqlite3.stub.php
+++ b/ext/sqlite3/sqlite3.stub.php
@@ -199,10 +199,8 @@ public function busyTimeout(int $milliseconds): bool {}
public function loadExtension(string $name): bool {}
#endif
-#if SQLITE_VERSION_NUMBER >= 3006011
/** @tentative-return-type */
public function backup(SQLite3 $destination, string $sourceDatabase = "main", string $destinationDatabase = "main"): bool {}
-#endif
/** @tentative-return-type */
public static function escapeString(string $string): string {}
diff --git a/ext/sqlite3/sqlite3_arginfo.h b/ext/sqlite3/sqlite3_arginfo.h
index d2b7410507f..60f63cb1094 100644
Binary files a/ext/sqlite3/sqlite3_arginfo.h and b/ext/sqlite3/sqlite3_arginfo.h differ