xref: /PHP-8.2/ext/mysqli/tests/gh7746.phpt (revision 05ed3b77)
1--TEST--
2Bug #GH-7746 mysqli_sql_exception->sqlstate is inaccessible
3--EXTENSIONS--
4mysqli
5--SKIPIF--
6<?php
7require_once 'skipifconnectfailure.inc';
8?>
9--FILE--
10<?php
11require 'connect.inc';
12$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
13
14mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
15
16try {
17    $link->query("stuff");
18} catch (mysqli_sql_exception $exception) {
19    var_dump($exception->getSqlState());
20}
21
22?>
23--EXPECT--
24string(5) "42000"
25