summaryrefslogtreecommitdiff
path: root/ext/sqlite3
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-06-12 11:34:01 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-06-12 11:34:01 +0200
commit2ba10ad0c580973a5f6c84ed7e2621e12d2e5358 (patch)
tree715c5fbc9950ffd58200b4000d126da98d2fc9b5 /ext/sqlite3
parentc7ad8a87383281fff0163e59cdc14655b67d86f4 (diff)
downloadphp-git-2ba10ad0c580973a5f6c84ed7e2621e12d2e5358.tar.gz
Revert accidental change
Not sure how this happened, but I seem to have reverted 2fd278bc211c2102422c8d8ce0905dfc43cb5c7f as part of 13868508386208f5a1a43b6c17991ad6f3652fea. Restore the change.
Diffstat (limited to 'ext/sqlite3')
-rw-r--r--ext/sqlite3/sqlite3.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c
index 895a1b0cfd..c309d5d545 100644
--- a/ext/sqlite3/sqlite3.c
+++ b/ext/sqlite3/sqlite3.c
@@ -135,13 +135,13 @@ PHP_METHOD(SQLite3, open)
rc = sqlite3_open_v2(fullpath, &(db_obj->db), flags, NULL);
if (rc != SQLITE_OK) {
- sqlite3_close(db_obj->db);
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
+ sqlite3_close(db_obj->db);
if (fullpath != filename) {
efree(fullpath);
}
@@ -151,8 +151,8 @@ PHP_METHOD(SQLite3, open)
#ifdef SQLITE_HAS_CODEC
if (encryption_key_len > 0) {
if (sqlite3_key(db_obj->db, encryption_key, encryption_key_len) != SQLITE_OK) {
- sqlite3_close(db_obj->db);
zend_throw_exception_ex(zend_ce_exception, 0, "Unable to open database: %s", sqlite3_errmsg(db_obj->db));
+ sqlite3_close(db_obj->db);
RETURN_THROWS();
}
}