|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79664 PDOStatement::getColumnMeta fails on empty result set
Submitted: 2020-06-02 00:23 UTC Modified: 2020-06-02 07:39 UTC
From: mic at kwayisi dot org Assigned: cmb (profile)
Status: Closed Package: PDO SQLite
PHP Version: 7.4.6 OS: Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: mic at kwayisi dot org
New email:
PHP Version: OS:


 [2020-06-02 00:23 UTC] mic at kwayisi dot org
PDOStatement::getColumnMeta throws a "column index out of range" error if the result set is empty.

After calling PDOStatement::columnCount to confirm that there are columns in the result set, subsequent call to PDOStatement::getColumnMeta shouldn't produce an error even if its implementation does not enable it to fetch the requested column (because there are no rows).

Test script:
$pdo = new PDO('sqlite:', null, null, [
$stmt = $pdo->query('select 1 where 0');
if ($stmt->columnCount())

Expected result:
array(6) {
  string(7) "integer"
  array(0) {
  string(1) "1"

Actual result:
ERROR: SQLSTATE[HY000]: General error: 25 column index out of range


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-06-02 07:39 UTC]
-Summary: PDOStatement::getColumnMeta should fail predictably for an empty result set +Summary: PDOStatement::getColumnMeta fails on empty result set -Status: Open +Status: Verified -Assigned To: +Assigned To: cmb
 [2020-06-02 07:55 UTC]
The following pull request has been associated:

Patch Name: Fix #79664: PDOStatement::getColumnMeta fails on empty result set
On GitHub:
 [2020-06-02 08:48 UTC]
Automatic comment on behalf of
Log: Fix #79664: PDOStatement::getColumnMeta fails on empty result set
 [2020-06-02 08:48 UTC]
-Status: Verified +Status: Closed
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jul 19 22:01:28 2024 UTC