Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork152
Add polyfill for PDO driver specific subclasses#549
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:1.x
Are you sure you want to change the base?
Conversation
nicolas-grekas left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Should we add the static connect method to every child class, since we can polyfill it there?
How does this method behave when given a DSN for another driver and when it's called on a child class?
Uh oh!
There was an error while loading.Please reload this page.
325af09 tof0b0b10Comparejnoordsij commentedOct 16, 2025
We could, but that feels a bit off to me. The whole idea of the |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
nicolas-grekas commentedOct 16, 2025
About the connect method on child classes, I'd still add it, for completness of the polyfill |
97852db to8034458CompareUh oh!
There was an error while loading.Please reload this page.
jnoordsij commentedOct 16, 2025
I probably will look into the last bits next week; if anyone is eager to finalize on the |
derrabus commentedOct 16, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
But if you are on PHP 8.4, would you really call the constructor of those subclasses instead of |
8034458 toa89fdfeComparejnoordsij commentedOct 20, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
To be fair, if one is currently only using something like |
ecd99c0 tof42017aComparejnoordsij commentedOct 20, 2025
I think this should be complete now as is. Additional feature-like tests could be nice, but on the other hand are probably very hard to implement in practice without any real database and I think the current set should suffice to prove this should work in practice. In particular the migration towards 'polyfilled' constants should be very safe to do with this. |
jnoordsij commentedNov 12, 2025
@nicolas-grekas with PHP 8.5 stable coming up next week, is there any chance of aiming to review and release this somewhere within that timeframe? |
nicolas-grekas left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Can you please proceed with these CS changes on all classes?
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
e04dc06 to62b8a86Comparejnoordsij commentedNov 12, 2025
Done! |
As a follow-up to#547, this PR aims to implement a full-fledged set of polyfills for the driver specific PDO subclasses introduced in PHP 8.4; see alsohttps://wiki.php.net/rfc/pdo_driver_specific_subclasses.
As of PHP 8.5, the driver specific constants and methods available on the base
PDOclass will be deprecated, to be removed in PHP 9.0. See alsohttps://wiki.php.net/rfc/deprecations_php_8_5#deprecate_driver_specific_pdo_constants_and_methods.This PR adds a polyfill to use the driver-specific child classes for PHP versions prior to PHP 8.4. This in turn allows one to already refer to the 'new' constant, to prevent deprecation errors on PHP 8.5, while retaining backwards compatibility. This can be particularly useful for code requiring support for multiple versions; see e.g.laravel/framework#57141.
The classes should be suitable for constructing on older PHP versions.
Note the
PDO::connectstatic method that has been introduced simultaneously has not been polyfilled, as I can't think of a proper way to do such a thing currently.