diff --git a/composer.lock b/composer.lock index 3031c5cd3389dc29a146e24477cfd95220e5015d..1baa19382bf85f4e5e4d9b0f064d77191050525b 100644 --- a/composer.lock +++ b/composer.lock @@ -2018,16 +2018,16 @@ }, { "name": "symfony/console", - "version": "v6.4.1", + "version": "v6.4.2", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "a550a7c99daeedef3f9d23fb82e3531525ff11fd" + "reference": "0254811a143e6bc6c8deea08b589a7e68a37f625" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/a550a7c99daeedef3f9d23fb82e3531525ff11fd", - "reference": "a550a7c99daeedef3f9d23fb82e3531525ff11fd", + "url": "https://api.github.com/repos/symfony/console/zipball/0254811a143e6bc6c8deea08b589a7e68a37f625", + "reference": "0254811a143e6bc6c8deea08b589a7e68a37f625", "shasum": "" }, "require": { @@ -2092,7 +2092,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.4.1" + "source": "https://github.com/symfony/console/tree/v6.4.2" }, "funding": [ { @@ -2108,7 +2108,7 @@ "type": "tidelift" } ], - "time": "2023-11-30T10:54:28+00:00" + "time": "2023-12-10T16:15:48+00:00" }, { "name": "symfony/dependency-injection", diff --git a/composer/Metapackage/CoreRecommended/composer.json b/composer/Metapackage/CoreRecommended/composer.json index 3b91bda6121f01b69547f38d6890cba342a200ab..e08f766dedd236df81ba752468adeee8d9fad6c7 100644 --- a/composer/Metapackage/CoreRecommended/composer.json +++ b/composer/Metapackage/CoreRecommended/composer.json @@ -32,7 +32,7 @@ "psr/log": "~3.0.0", "ralouphie/getallheaders": "~3.0.3", "sebastian/diff": "~4.0.5", - "symfony/console": "~v6.4.1", + "symfony/console": "~v6.4.2", "symfony/dependency-injection": "~v6.4.1", "symfony/deprecation-contracts": "~v3.4.0", "symfony/error-handler": "~v6.4.0", diff --git a/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php index c01183e991ddc3892dc555a96faddf5cb6a5ba53..da96c9dbfc06eb857d2cb1914cbd82e047b04934 100644 --- a/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php @@ -12,7 +12,6 @@ use Drupal\Core\Site\Settings; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\StreamedResponse; use Symfony\Component\HttpKernel\Event\ResponseEvent; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\EventDispatcher\EventSubscriberInterface; @@ -301,23 +300,6 @@ protected function setExpiresNoCache(Response $response) { $response->setExpires(\DateTime::createFromFormat('j-M-Y H:i:s T', '19-Nov-1978 05:00:00 UTC')); } - /** - * Sets the Content-Length header on the response. - * - * @param \Symfony\Component\HttpKernel\Event\ResponseEvent $event - * The event to process. - */ - public function setContentLengthHeader(ResponseEvent $event): void { - $response = $event->getResponse(); - // @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; - } - - $response->headers->set('Content-Length', strlen($response->getContent()), TRUE); - } - /** * Registers the methods in this class that should be listeners. * @@ -329,10 +311,6 @@ public static function getSubscribedEvents(): array { // There is no specific reason for choosing 16 beside it should be executed // before ::onRespond(). $events[KernelEvents::RESPONSE][] = ['onAllResponds', 16]; - // Run very late, after all other response subscribers have run. However, - // any response subscribers that convert a response to a streamed response - // must run after this and undo what this does. - $events[KernelEvents::RESPONSE][] = ['setContentLengthHeader', -1024]; return $events; } diff --git a/core/modules/package_manager/tests/src/Kernel/SymlinkValidatorTest.php b/core/modules/package_manager/tests/src/Kernel/SymlinkValidatorTest.php index c61c2c5f54451966d5af5d55aa7452665daf4b3a..fe77dd7983fb97073d830cd049be0fb8a9bbee0c 100644 --- a/core/modules/package_manager/tests/src/Kernel/SymlinkValidatorTest.php +++ b/core/modules/package_manager/tests/src/Kernel/SymlinkValidatorTest.php @@ -22,19 +22,20 @@ class SymlinkValidatorTest extends PackageManagerKernelTestBase { * Tests that relative symlinks within the same package are supported. */ public function testSymlinksWithinSamePackage(): void { - $original_dir = getcwd(); + $project_root = $this->container->get(PathLocator::class) + ->getProjectRoot(); - $drush_dir = $this->container->get(PathLocator::class)->getProjectRoot() . '/vendor/drush/drush'; + $drush_dir = $project_root . '/vendor/drush/drush'; mkdir($drush_dir . '/docs', 0777, TRUE); touch($drush_dir . '/drush_logo-black.png'); // Relative symlinks must be made from their actual directory to be // correctly evaluated. chdir($drush_dir . '/docs'); symlink('../drush_logo-black.png', 'drush_logo-black.png'); - // Switch back to the original directory to ensure that the check isn't - // affected by which directory we happen to be in. - chdir($original_dir); + // Switch back to the Drupal root to ensure that the check isn't affected + // by which directory we happen to be in. + chdir($this->getDrupalRoot()); $this->assertStatusCheckResults([]); } @@ -168,7 +169,6 @@ public function providerSymlinkToDirectory(): array { * @dataProvider providerSymlinkToDirectory */ public function testSymlinkToDirectory(string $file_syncer, array $expected_results): void { - $original_dir = getcwd(); $project_root = $this->container->get(PathLocator::class) ->getProjectRoot(); @@ -182,7 +182,9 @@ public function testSymlinkToDirectory(string $file_syncer, array $expected_resu ->set('file_syncer', $file_syncer) ->save(); - chdir($original_dir); + // Switch back to the Drupal root to ensure that the check isn't affected + // by which directory we happen to be in. + chdir($this->getDrupalRoot()); $this->assertStatusCheckResults($expected_results); }