From ab2b86539f5019b2c5bdb4a10deda1200b51a5ca Mon Sep 17 00:00:00 2001 From: Ted Bowman <ted+git@tedbow.com> Date: Mon, 23 Oct 2023 17:11:23 -0400 Subject: [PATCH] fix batch response --- .../Drupal/Core/EventSubscriber/FinishResponseSubscriber.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php index 8dc9bac392ea..bbc92c8cc89e 100644 --- a/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php @@ -307,7 +307,9 @@ protected function setExpiresNoCache(Response $response) { */ public function setContentLengthHeader(ResponseEvent $event): void { $response = $event->getResponse(); - if ($response instanceof StreamedResponse) { + // @todo The batch system will break unless we check ob_get_level(). See + // https://drupal.org/i/3392196. + if ($response instanceof StreamedResponse || ob_get_level()) { return; } -- GitLab