Fix PHP 8.5 PDO deprecations, keep compatibility with older PHP - #25
Fix PHP 8.5 PDO deprecations, keep compatibility with older PHP#25xaben wants to merge 1 commit into
Conversation
PHP 8.5 deprecates driver-specific constants defined on the base PDO class in favor of the Pdo\<Driver> subclasses added in PHP 8.4. Resolve PDO::MYSQL_ATTR_USE_BUFFERED_QUERY and DSN fragment option constants (eg. MYSQL_ATTR_INIT_COMMAND) conditionally so the library keeps working unchanged on PHP < 8.4 while avoiding the new deprecation notices. Also add #[AllowDynamicProperties] to several classes that were still missing it, which have been raising dynamic-property deprecations since PHP 8.2.
|
I've released a new version which fixes the constants - we now only accept the PHP8.4 constants now For the dynamic property, could you elicit why that is needed because the AI analysis I did could not work out why um that would be justified. (note there was a few fixes to add named properties to a few classes) |
|
@roojs Thank you for the very quick turn around, this unblocks us. As for the "AllowDynamicProperties", I've rechecked the usage and manually confirmed what the AI came back with, these are the places that do create dynamic properties (the last one might be not needed, if we were to validate the keys being passed in):
|
|
try the new build - i think it should fix both - links is just using univeral ctor - so filtering fixes it, and join - just added the _join property - also split the exceptions |
Hi @roojs, we are trying to update to the newer PHP version, and we've run into quite a few deprecations coming from PDO_DataObject. Could you please review the below fix? Greatly appreciated.
PHP 8.5 deprecates driver-specific constants defined on the base PDO class in favor of the Pdo<Driver> subclasses added in PHP 8.4. Resolve PDO::MYSQL_ATTR_USE_BUFFERED_QUERY and DSN fragment option constants (eg. MYSQL_ATTR_INIT_COMMAND) conditionally so the library keeps working unchanged on PHP < 8.4 while avoiding the new deprecation notices.
Also add #[AllowDynamicProperties] to several classes that were still missing it, which have been raising dynamic-property deprecations since PHP 8.2.