Skip to content

Conversation

@whygareth
Copy link

Summary

This PR addresses the deprecation warning for PDO::MYSQL_ATTR_SSL_CA introduced in PHP 8.4 (and present in PHP 8.5 builds).

The Issue

In newer PHP versions, the PDO::MYSQL_ATTR_SSL_CA constant is deprecated in favor of the namespaced Pdo\Mysql::ATTR_SSL_CA. Using the old constant results in a deprecation notice.

The Solution

I have updated config/database.php to use a conditional check. The configuration now uses the new Pdo\Mysql::ATTR_SSL_CA constant if it is defined, while falling back to the legacy PDO::MYSQL_ATTR_SSL_CA constant for older PHP versions to ensure backward compatibility.

Affects

  • MySQL connection
  • MariaDB connection
  • WordPress connection

@Log1x
Copy link
Member

Log1x commented Nov 28, 2025

Hey thanks for this! It looks like this was actually addressed in Laravel a few days ago. Would you want to copy over the exact fix they did in https://github.com/laravel/laravel/blob/12.x/config/database.php ? Namely checking the PHP version.

@whygareth
Copy link
Author

Good call! Thanks for the heads up.
I've updated the check to use PHP_VERSION_ID, but I stuck with 80400 (PHP 8.4) instead of 80500. Since the deprecation starts in 8.4, using 80500 would sadly leave those users with the warning still active.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants