diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2020-06-02 09:36:39 +0200 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2020-06-02 10:45:47 +0200 |
commit | 63bd8f38f4b7e8ffbcbd0ea607e21041ebba2455 (patch) | |
tree | b3cf4c1756182744627081fb0454db73a4ef1bc6 /ext/pdo_sqlite/sqlite_statement.c | |
parent | 923c45bdcaebf317ce84a4bfb3fa39beae1bf952 (diff) | |
download | php-git-63bd8f38f4b7e8ffbcbd0ea607e21041ebba2455.tar.gz |
Fix #79664: PDOStatement::getColumnMeta fails on empty result set
As its name suggests, `sqlite3_data_count` returns the number of
columns in the current row of the result set; we are interested in the
number of columns regardless of the current row, so we have to use
`sqlite3_column_count` instead.
Diffstat (limited to 'ext/pdo_sqlite/sqlite_statement.c')
-rw-r--r-- | ext/pdo_sqlite/sqlite_statement.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/pdo_sqlite/sqlite_statement.c b/ext/pdo_sqlite/sqlite_statement.c index c51ab53956..5aae9a073b 100644 --- a/ext/pdo_sqlite/sqlite_statement.c +++ b/ext/pdo_sqlite/sqlite_statement.c @@ -337,7 +337,7 @@ static int pdo_sqlite_stmt_col_meta(pdo_stmt_t *stmt, zend_long colno, zval *ret if (!S->stmt) { return FAILURE; } - if(colno >= sqlite3_data_count(S->stmt)) { + if(colno >= sqlite3_column_count(S->stmt)) { /* error invalid column */ pdo_sqlite_error_stmt(stmt); return FAILURE; |