- 🇮🇹Italy apaderno Brescia, 🇮🇹
In
DatabaseConnection
, the patch adds this code.+ /** + * Do the actual commit, invoke pre-commit callbacks. + * + * @internal + */ + protected function doCommit() { + $success = $this->connection->commit(); + $this->executeRootTransactionEndCallbacks($success); + + if (!$success) { + throw new DatabaseTransactionCommitFailedException(); + } + }
In
DatabaseConnection_mysql
, the code is changed as follows.protected function doCommit() { if ($this->connection->inTransaction()) { - return $this->connection->commit(); + $success = parent::doCommit(); } else { // In PHP 8.0 a PDOException is thrown when a commit is attempted with no // transaction active. In previous PHP versions this failed silently. - return TRUE; + $success = TRUE; + // Allow callbacks to perform their own cleanup. + $this->executeRootTransactionEndCallbacks($success); } + return $success; }
$success = parent::doCommit();
would just set$success
toNULL
, sinceDatabaseConnection::doCommit()
does not return any value. - Merge request !7510Issue #3004437: Add ability to register rootEndTransaction callbacks during transactions → (Open) created by apaderno
- last update
about 1 year ago 2,179 pass