Add forward compatibility for PDO MySQL driver constants#99
Merged
Conversation
PHP 8.4 introduced driver-specific `PDO` MySQL constants on `Pdo\Mysql`, and PHP 8.5 deprecates accessing those constants through the generic `PDO` class. Add a forward-compatibility shim that provides `Pdo\Mysql::ATTR_*` on older PHP versions when pdo_mysql is available. The shim mirrors the mysqlnd and non-mysqlnd differences in available constants so existing code can switch to the driver-specific API without dropping support for older runtimes.
Replace deprecated `PDO::MYSQL_*` constant usage with the driver-specific `Pdo\Mysql::ATTR_*` constants introduced in PHP 8.4. This prepares the code for PHP 8.5, where accessing MySQL driver constants through the generic `PDO` class is deprecated. This change requires the compatibility shim (074d118) on older PHP versions to provide `Pdo\Mysql` for runtimes that do not expose the driver-specific class yet.
BastianLedererIcinga
approved these changes
Mar 10, 2026
Contributor
BastianLedererIcinga
left a comment
There was a problem hiding this comment.
Looks good, tested in on 8.3, 8.4 and 8.5 and got no warnings.
Member
Author
Can you adapt other repositories in which changes regarding the PDO constants have already been merged or are open? |
This was referenced Mar 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PHP 8.4 introduced driver-specific
PDOMySQL constants onPdo\Mysql, andPHP 8.5 deprecates accessing those constants through the generic
PDOclass.Add a forward-compatibility shim that provides
Pdo\Mysql::ATTR_*on older PHPversions when pdo_mysql is available. The shim mirrors the mysqlnd and
non-mysqlnd differences in available constants so existing code can switch to
the driver-specific API without dropping support for older runtimes.