From 78b2e35a2ea09352f66738b49f87a99a9470b10d Mon Sep 17 00:00:00 2001 From: Darko Gjorgjijoski <5760249+gdarko@users.noreply.github.com> Date: Wed, 29 Jul 2026 11:50:17 +0200 Subject: [PATCH] fix(config): resolve the mysql SSL CA attribute per PHP version (#701) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PHP 8.5 deprecated PDO::MYSQL_ATTR_SSL_CA in favour of Pdo\Mysql::ATTR_SSL_CA, so on 8.5 every test in the suite was reported as deprecated rather than passed — noise that would hide a real one. Pdo\Mysql does not exist before 8.5 and this package supports ^8.4, so the constant is resolved at runtime; the untaken ternary branch is never looked up, which keeps 8.4 working. The lookup stays behind the extension_loaded() check because neither name is defined when pdo_mysql is missing. Verified against both runtimes: with MYSQL_ATTR_SSL_CA set, 8.4 resolves to attribute 1009 and 8.5 to 1008 — each version's own value, matching what the previous code produced there. Same change as InvoiceShelf/InvoiceShelf#696 on 3.x. --- config/database.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/config/database.php b/config/database.php index 53dcae02..40804c6b 100644 --- a/config/database.php +++ b/config/database.php @@ -1,6 +1,16 @@ = 80500 ? Mysql::ATTR_SSL_CA : PDO::MYSQL_ATTR_SSL_CA) + : null; return [ @@ -58,8 +68,8 @@ return [ 'prefix_indexes' => true, 'strict' => true, 'engine' => null, - 'options' => extension_loaded('pdo_mysql') ? array_filter([ - PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), + 'options' => $mysqlSslCaAttribute !== null ? array_filter([ + $mysqlSslCaAttribute => env('MYSQL_ATTR_SSL_CA'), ]) : [], ], @@ -78,8 +88,8 @@ return [ 'prefix_indexes' => true, 'strict' => true, 'engine' => null, - 'options' => extension_loaded('pdo_mysql') ? array_filter([ - PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), + 'options' => $mysqlSslCaAttribute !== null ? array_filter([ + $mysqlSslCaAttribute => env('MYSQL_ATTR_SSL_CA'), ]) : [], ],