php 8.5: deprecated PDO constants and functions

Author: jamieburchellCreated Oct 22, 2025Updated Jan 19, 2026

As per upcoming PHP 8.5 deprecations

There are a huge number of driver-specific constants and methods defined on the main PDO class; as examples, PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, PDO::pgsqlCopyFromArray(). PHP 8.4 introduced driver-specific subclasses of PDO, and all of these are now defined in those subclasses.

PHP 8.5 deprecates usage of the PDO constants and methods in favor of those.

For interested parties there's a preliminary fix in this branch which has been lightly tested with PDO for MySQL (I usually use the mysqli driver). This change will require PHP >= 8.4.

The patch also returns the respective subclass where available, instead of the generic PDO class.