Skip to content

Commit 1749210

Browse files
ikidnapmyselfclaude
andcommitted
fix: avoid deprecated PDO::MYSQL_ATTR_SSL_CA on PHP 8.5
PHP 8.5 deprecates PDO::MYSQL_ATTR_SSL_CA in favour of Pdo\Mysql::ATTR_SSL_CA, which doesn't exist on PHP 8.3 (our target / CI version). Select the new constant only when the runtime defines it, falling back to the old one otherwise. defined() doesn't trigger the deprecation, so 8.5 stays clean while 8.3 keeps working. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 7ad96b6 commit 1749210

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

config/database.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@
5959
'strict' => true,
6060
'engine' => null,
6161
'options' => extension_loaded('pdo_mysql') ? array_filter([
62-
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
62+
// PDO::MYSQL_ATTR_SSL_CA is deprecated in PHP 8.5; prefer the
63+
// Pdo\Mysql::ATTR_SSL_CA constant when the runtime provides it.
64+
(defined('Pdo\Mysql::ATTR_SSL_CA') ? Pdo\Mysql::ATTR_SSL_CA : PDO::MYSQL_ATTR_SSL_CA) => env('MYSQL_ATTR_SSL_CA'),
6365
]) : [],
6466
],
6567

0 commit comments

Comments
 (0)