Skip to content

mysqli->ping() throws an exception if the connection is broken #11897

Closed
@TheNewHEROBRINEX

Description

@TheNewHEROBRINEX

Description

$mysqli->ping() should return false if the connection is broken but instead it produces the following error:

Fatal error: Uncaught mysqli_sql_exception: Malformed packet in /home/luca/mysql-test.php:17  
Stack trace:  
#0 /home/luca/mysql-test.php(17): mysqli->ping()  
#1 {main}  
  thrown in /home/luca/mysql-test.php on line 17

Reproducing code: https://gist.github.com/TheNewHEROBRINEX/0a855115642216bc79203de5d6784c14
To simulate a broken connection you can restart the MySQL server.

PHP Version

PHP 8.2.8

Operating System

Ubuntu 23.04

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions