Change record status: 
Project: 
Introduced in branch: 
11.5.x
Introduced in version: 
11.5.0
Description: 

Drupal by default was committing a database transaction when its Transaction object goes out of scope, during the Transaction object destruction.

The new Transaction::commitOrRelease() method is now being used all across Drupal's core codebase to explicitly perform a commit/savepoint release operation on a database transaction.

Besides:

  • The implicit commit on Transaction destruction behaviour is deprecated, and its implementation will be removed in Drupal 13.
  • The methods introduced in #3405976: Transaction autocommit during shutdown relies on unreliable object destruction order (xdebug 3.3+ enabled) are deprecated for removal in Drupal 13, without replacement:
    • Connection::commitAll()
    • Database::commitAllOnShutdown()
    • TransactionManagerBase::commitAll()
  • The following methods in Drupal\pgsql\Driver\Database\pgsql\Connection are deprecated for removal in Drupal 13:
    • ::addSavepoint() replaced by Connection::startTransaction()
    • ::releaseSavepoint() replaced by Transaction::commitOrRelease()
    • ::rollbackSavepoint() replaced by Transaction::rollback()

Read Transaction::commitOrRelease() method introduced to explicit commit a transaction for before/after examples.

Impacts: 
Module developers