Skip to content

mysqli_fetch_assoc reports error from nested query #14255

Closed

Description

@kamil-tekiela

Description

The following code:

<?php

$ca = $mysqli->query('SELECT 1 ');
$c = $ca->fetch_assoc();
try {
    $mysqli->query('SELECT non_existent_column');
} catch (Exception $e) {
    echo "Caught exception"."\n";
}
$c = $ca->fetch_assoc();

Resulted in this output:

Caught exception

Fatal error: Uncaught mysqli_sql_exception: Unknown column 'non_existent_column' in 'field list' ... 

But I expected this output instead:

Caught exception

PHP Version

PHP 8.2

Operating System

No response

Activity

  1. ndossche commented on May 18, 2024

    @ndossche
    Member

    This was fixed by #14256, but because the commit title didn't include the bug number GH didn't close it automatically. Manually closing it now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions