From bcb1373d0e22b87b0784501716d15235d8b9deef Mon Sep 17 00:00:00 2001 From: Jan Skrasek Date: Sat, 9 Nov 2024 20:00:20 +0100 Subject: [PATCH] replace Mysqli::ping() with simple SELECT 1 to fix PHP 8.4 deprecation --- src/Drivers/Mysqli/MysqliDriver.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Drivers/Mysqli/MysqliDriver.php b/src/Drivers/Mysqli/MysqliDriver.php index b2eea6e..81054f2 100644 --- a/src/Drivers/Mysqli/MysqliDriver.php +++ b/src/Drivers/Mysqli/MysqliDriver.php @@ -209,8 +209,12 @@ public function getServerVersion(): string public function ping(): bool { $this->checkConnection(); - assert($this->connection !== null); - return $this->connection->ping(); + try { + $this->query('SELECT 1'); + return true; + } catch (DriverException) { + return false; + } }