Skip to content

Commit

Permalink
replace Mysqli::ping() with simple SELECT 1 to fix PHP 8.4 deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
hrach committed Nov 9, 2024
1 parent a9ddc37 commit bcb1373
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Drivers/Mysqli/MysqliDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}


Expand Down

0 comments on commit bcb1373

Please sign in to comment.