xref: /PHP-8.2/ext/mysqli/tests/gh14255.phpt (revision a59868ae)
1--TEST--
2Bug GH-14255 (mysqli_fetch_assoc reports error from nested query)
3--EXTENSIONS--
4mysqli
5--SKIPIF--
6<?php
7require_once 'skipifconnectfailure.inc';
8?>
9--FILE--
10<?php
11
12require_once 'connect.inc';
13
14mysqli_report(MYSQLI_REPORT_STRICT|MYSQLI_REPORT_ERROR);
15
16$mysqli = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
17
18$ca = $mysqli->query('SELECT 1 ');
19$c = $ca->fetch_assoc();
20try {
21    $mysqli->query('SELECT non_existent_column');
22} catch (Exception $e) {
23    echo "Caught exception"."\n";
24}
25$c = $ca->fetch_assoc();
26
27print "done!";
28?>
29--EXPECTF--
30Caught exception
31done!
32