Skip to content

mysqli_fetch_assoc reports error from nested query #14255

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions