Loading core/lib/Drupal/Core/Database/Transaction/TransactionManagerBase.php +0 −5 Original line number Diff line number Diff line Loading @@ -170,11 +170,6 @@ public function commitAll(): void { foreach (array_reverse($this->stack()) as $id => $item) { $this->unpile($item->name, $id); } // Run post-transaction callbacks now (while Connection is still valid). // Prevents destructor-order bug: Connection::__destruct can run before // Transaction::__destruct, leaving PDO null when callbacks run. $this->processPostTransactionCallbacks(); } /** Loading core/tests/Drupal/KernelTests/Core/Database/TransactionTest.php +0 −29 Original line number Diff line number Diff line Loading @@ -1249,35 +1249,6 @@ public function testRootTransactionEndCallbackFailureUponDdlAndRollbackForNonTra $this->assertRowPresent('row'); } /** * Tests post-transaction callback executes on "garbage collection". * * Simulate the end of a request by closing the connection and destroying * the transaction manually. The order matters for this test as the garbage * collection is unpredictable and could operate this way. */ public function testPostTransactionsAlwaysExecutedBeforeConnectionIsDestroyed(): void { $transaction = $this->createRootTransaction('', FALSE); $this->connection->transactionManager()->addPostTransactionCallback([$this, 'rootTransactionCallback']); $this->insertRow('row'); $this->assertNull($this->postTransactionCallbackAction); $this->assertRowAbsent('rtcCommit'); Database::closeConnection(); // @phpstan-ignore unset.possiblyHookedProperty unset($this->connection); unset($transaction); // Reopen the database connection so we can continue running assertions. $this->connection = Database::getConnection(); // The post-transaction callback should now have inserted a 'rtcCommit' // row. $this->assertSame('rtcCommit', $this->postTransactionCallbackAction); $this->assertRowPresent('row'); $this->assertRowPresent('rtcCommit'); } /** * A post-transaction callback for testing purposes. */ Loading Loading
core/lib/Drupal/Core/Database/Transaction/TransactionManagerBase.php +0 −5 Original line number Diff line number Diff line Loading @@ -170,11 +170,6 @@ public function commitAll(): void { foreach (array_reverse($this->stack()) as $id => $item) { $this->unpile($item->name, $id); } // Run post-transaction callbacks now (while Connection is still valid). // Prevents destructor-order bug: Connection::__destruct can run before // Transaction::__destruct, leaving PDO null when callbacks run. $this->processPostTransactionCallbacks(); } /** Loading
core/tests/Drupal/KernelTests/Core/Database/TransactionTest.php +0 −29 Original line number Diff line number Diff line Loading @@ -1249,35 +1249,6 @@ public function testRootTransactionEndCallbackFailureUponDdlAndRollbackForNonTra $this->assertRowPresent('row'); } /** * Tests post-transaction callback executes on "garbage collection". * * Simulate the end of a request by closing the connection and destroying * the transaction manually. The order matters for this test as the garbage * collection is unpredictable and could operate this way. */ public function testPostTransactionsAlwaysExecutedBeforeConnectionIsDestroyed(): void { $transaction = $this->createRootTransaction('', FALSE); $this->connection->transactionManager()->addPostTransactionCallback([$this, 'rootTransactionCallback']); $this->insertRow('row'); $this->assertNull($this->postTransactionCallbackAction); $this->assertRowAbsent('rtcCommit'); Database::closeConnection(); // @phpstan-ignore unset.possiblyHookedProperty unset($this->connection); unset($transaction); // Reopen the database connection so we can continue running assertions. $this->connection = Database::getConnection(); // The post-transaction callback should now have inserted a 'rtcCommit' // row. $this->assertSame('rtcCommit', $this->postTransactionCallbackAction); $this->assertRowPresent('row'); $this->assertRowPresent('rtcCommit'); } /** * A post-transaction callback for testing purposes. */ Loading