diff --git a/Resources/config/middlewares.xml b/Resources/config/middlewares.xml
index f1c0d1f2f..a0d408c52 100644
--- a/Resources/config/middlewares.xml
+++ b/Resources/config/middlewares.xml
@@ -8,7 +8,6 @@
-
diff --git a/Tests/DependencyInjection/DoctrineExtensionTest.php b/Tests/DependencyInjection/DoctrineExtensionTest.php
index e9da37289..fe5881001 100644
--- a/Tests/DependencyInjection/DoctrineExtensionTest.php
+++ b/Tests/DependencyInjection/DoctrineExtensionTest.php
@@ -1223,6 +1223,35 @@ public function testDefinitionsToLogQueries(bool $withMiddleware, bool $loggerIn
$this->assertFalse(in_array(['connection' => 'conn2'], $middleWareTagAttributes, true), 'Tag with connection conn2 found');
}
+ public function testDefinitionsToLogQueriesLoggingFalse(): void
+ {
+ /** @psalm-suppress UndefinedClass */
+ if (! class_exists(Middleware::class)) {
+ $this->markTestSkipped(sprintf('%s needs %s to not exist', __METHOD__, Middleware::class));
+ }
+
+ $container = $this->getContainer();
+ $extension = new DoctrineExtension();
+
+ $config = BundleConfigurationBuilder::createBuilderWithBaseValues()
+ ->addConnection([
+ 'connections' => [
+ 'conn' => [
+ 'password' => 'foo',
+ 'logging' => false,
+ ],
+ ],
+ ])
+ ->addBaseEntityManager()
+ ->build();
+
+ $extension->load([$config], $container);
+
+ $this->assertTrue($container->hasDefinition('doctrine.dbal.logging_middleware'));
+ $abstractMiddlewareDefTags = $container->getDefinition('doctrine.dbal.logging_middleware')->getTags();
+ $this->assertArrayNotHasKey('doctrine.middleware', $abstractMiddlewareDefTags);
+ }
+
// phpcs:enable
/** @param list $bundles */