Skip to content

Commit 0de9662

Browse files
Merge branch '5.4' into 6.4
* 5.4: [Console][PhpUnitBridge][VarDumper] Fix `NO_COLOR` empty value handling [Translation] Fix CSV escape char in `CsvFileLoader` on PHP >= 7.4 [DoctrineBridge] fix messenger bus dispatch inside an active transaction [HttpFoundation] Add tests for uncovered sections treat uninitialized properties referenced by property paths as null properly set up constraint options [ErrorHandler][VarDumper] Remove PHP 8.4 deprecations [Core] Fix & Enhance security arabic translation.
2 parents 64d024f + 009d870 commit 0de9662

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Messenger/DoctrineOpenTransactionLoggerMiddleware.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@ protected function handleForManager(EntityManagerInterface $entityManager, Envel
4141
}
4242

4343
$this->isHandling = true;
44+
$initialTransactionLevel = $entityManager->getConnection()->getTransactionNestingLevel();
4445

4546
try {
4647
return $stack->next()->handle($envelope, $stack);
4748
} finally {
48-
if ($entityManager->getConnection()->isTransactionActive()) {
49+
if ($entityManager->getConnection()->getTransactionNestingLevel() > $initialTransactionLevel) {
4950
$this->logger?->error('A handler opened a transaction but did not close it.', [
5051
'message' => $envelope->getMessage(),
5152
]);

Tests/Messenger/DoctrineOpenTransactionLoggerMiddlewareTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ public function log($level, $message, $context = []): void
5151

5252
public function testMiddlewareWrapsInTransactionAndFlushes()
5353
{
54-
$this->connection->expects($this->exactly(1))
55-
->method('isTransactionActive')
56-
->willReturn(true, true, false)
54+
$this->connection->expects($this->exactly(2))
55+
->method('getTransactionNestingLevel')
56+
->willReturn(0, 1)
5757
;
5858

5959
$this->middleware->handle(new Envelope(new \stdClass()), $this->getStackMock());

0 commit comments

Comments
 (0)