Change record status: 
Project: 
Introduced in branch: 
9.1.x
Introduced in version: 
9.1.0
Description: 

New StatementWrapper class added to wrap PHP's built-in \PDOStatement. In PHP 8, \PDOStatement has changed and Drupal's \Drupal\Core\Database\StatementInterface is incompatible. This makes it impossible to use \Drupal\Core\Database\Statement on PHP 8. In order to overcome this core's MySQL and Postgres drivers now use \Drupal\Core\Database\StatementWrapper instead.

Unless your code uses a custom database driver there is nothing to do.

Custom/contrib database driver code that uses PHP's PDO is encouraged to set \Drupal\Core\Database\Connection::$statementWrapperClass to \Drupal\Core\Database\StatementWrapper and to set \Drupal\Core\Database\Connection::$statementClass to NULL. For example:

  /**
   * {@inheritdoc}
   */
  protected $statementClass = NULL;

  /**
   * {@inheritdoc}
   */
  protected $statementWrapperClass = StatementWrapper::class;

Using the property \Drupal\Core\Database\Connection::$statementClass is now deprecated.

Impacts: 
Module developers
Site templates, recipes and distribution developers