xref: /php-src/ext/mysqli/tests/bug81335.phpt (revision 555b603d)
1--TEST--
2Bug #81335: Packets out of order after connection timeout
3--EXTENSIONS--
4mysqli
5--SKIPIF--
6<?php
7if (PHP_OS === 'WINNT') die('skip on windows');
8if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
9
10require_once 'connect.inc';
11if (!$link = @my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) die("skip cannot connect");
12if (mysqli_get_server_version($link) < 80024 || str_contains(mysqli_get_server_info($link), 'MariaDB')) {
13    die("skip: Due to many MySQL Server differences, the test requires >= 8.0.24");
14}
15?>
16--FILE--
17<?php
18
19require_once 'connect.inc';
20mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
21$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
22$mysqli->query('SET WAIT_TIMEOUT=1');
23usleep(1000000 * 1.1);
24try {
25    $mysqli->query('SELECT 1 + 1');
26} catch(mysqli_sql_exception $e) {
27    echo $e->getMessage();
28    echo "\n";
29    echo $e->getCode();
30}
31?>
32--EXPECTF--
33The client was disconnected by the server because of inactivity. See wait_timeout and interactive_timeout for configuring this behavior.
344031
35