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