Skip to content

Commit

Permalink
Merge branch '7.0' into 7.1
Browse files Browse the repository at this point in the history
* 7.0:
  [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
  move adding detailed JSON error messages to the validate phase
  [Profiler] Add word wrap in tables in dialog to see all the text
  [Core] Fix & Enhance security arabic translation.
  [HttpFoundation] Add tests for `MethodRequestMatcher` and `SchemeRequestMatcher`
  • Loading branch information
nicolas-grekas committed Jul 26, 2024
2 parents 9fc4beb + 462b41a commit b526822
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Messenger/DoctrineOpenTransactionLoggerMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,12 @@ protected function handleForManager(EntityManagerInterface $entityManager, Envel
}

$this->isHandling = true;
$initialTransactionLevel = $entityManager->getConnection()->getTransactionNestingLevel();

try {
return $stack->next()->handle($envelope, $stack);
} finally {
if ($entityManager->getConnection()->isTransactionActive()) {
if ($entityManager->getConnection()->getTransactionNestingLevel() > $initialTransactionLevel) {
$this->logger?->error('A handler opened a transaction but did not close it.', [
'message' => $envelope->getMessage(),
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ public function log($level, $message, $context = []): void

public function testMiddlewareWrapsInTransactionAndFlushes()
{
$this->connection->expects($this->exactly(1))
->method('isTransactionActive')
->willReturn(true, true, false)
$this->connection->expects($this->exactly(2))
->method('getTransactionNestingLevel')
->willReturn(0, 1)
;

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

0 comments on commit b526822

Please sign in to comment.