Skip to content

Commit 7b8b2e5

Browse files
committed
Switch to the v2 version of these functions.
The sqlite3 docs suggest always using prepare_v2 and the close_v2 could potentially help with an fd leak we have been seeing
1 parent 5d0048c commit 7b8b2e5

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ PHP NEWS
9999
. Fixed bug #73959 (lastInsertId fails to throw an exception for wrong
100100
sequence name). (andrewnester)
101101

102+
- PDO_Sqlite
103+
. Switch to sqlite3_prepare_v2() and sqlite3_close_v2() functions (rasmus)
104+
102105
- posix:
103106
. Fixed bug #71219 (configure script incorrectly checks for ttyname_r). (atoh)
104107

UPGRADING

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,10 @@ PHP 7.2 UPGRADE NOTES
189189
. mb_convert_encoding() accepts array parameter. Only value encodings
190190
are converted recursively.
191191

192+
- pdo_sqlite
193+
. Use sqlite3_prepare_v2() and sqlite3_close_v2() functions instead of their
194+
legacy counterparts.
195+
192196
========================================
193197
10. New Global Constants
194198
========================================

ext/pdo_sqlite/sqlite_driver.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ static int sqlite_handle_closer(pdo_dbh_t *dbh) /* {{{ */
161161

162162
pdo_sqlite_cleanup_callbacks(H);
163163
if (H->db) {
164-
sqlite3_close(H->db);
164+
sqlite3_close_v2(H->db);
165165
H->db = NULL;
166166
}
167167
if (einfo->errmsg) {
@@ -193,7 +193,7 @@ static int sqlite_handle_preparer(pdo_dbh_t *dbh, const char *sql, size_t sql_le
193193
return 0;
194194
}
195195

196-
i = sqlite3_prepare(H->db, sql, sql_len, &S->stmt, &tail);
196+
i = sqlite3_prepare_v2(H->db, sql, sql_len, &S->stmt, &tail);
197197
if (i == SQLITE_OK) {
198198
return 1;
199199
}

0 commit comments

Comments
 (0)