From 0eb61835f813778631f6d8f00c493392368daee3 Mon Sep 17 00:00:00 2001 From: Antoni Villalonga Date: Mon, 4 Mar 2024 00:26:57 +0000 Subject: [PATCH] Avoid query rerun. Partial fix: #13587 --- ext/sqlite3/sqlite3.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index cad3796ffdbf7..aa15617919cdd 100644 --- a/ext/sqlite3/sqlite3.c +++ b/ext/sqlite3/sqlite3.c @@ -595,6 +595,10 @@ PHP_METHOD(SQLite3, query) result->column_count = -1; ZVAL_OBJ(&result->stmt_obj_zval, Z_OBJ(stmt)); + if (sqlite3_column_count(result->stmt_obj->stmt) == 0) { + return; + } + return_code = sqlite3_step(result->stmt_obj->stmt); switch (return_code) {