diff --git a/composer.lock b/composer.lock index 7461ee20280..7548d2e5b8e 100644 --- a/composer.lock +++ b/composer.lock @@ -9999,8 +9999,8 @@ }, "prefer-stable": true, "prefer-lowest": false, - "platform": [], - "platform-dev": [], + "platform": {}, + "platform-dev": {}, "platform-overrides": { "php": "8.1.0" }, diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php index 9978040a588..99b26c0e544 100644 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -779,6 +779,7 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface { if ($e instanceof HttpExceptionInterface) { $response = new Response($e->getMessage(), $e->getStatusCode()); $response->headers->add($e->getHeaders()); + $response->headers->set('Content-Type', 'text/plain'); return $response; } diff --git a/core/lib/Drupal/Core/EventSubscriber/DefaultExceptionHtmlSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/DefaultExceptionHtmlSubscriber.php index 4642d434fcf..67ab669bade 100644 --- a/core/lib/Drupal/Core/EventSubscriber/DefaultExceptionHtmlSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/DefaultExceptionHtmlSubscriber.php @@ -87,21 +87,14 @@ class DefaultExceptionHtmlSubscriber extends HttpExceptionSubscriberBase { * The event to process. */ public function on4xx(ExceptionEvent $event) { - if (($exception = $event->getThrowable()) && $exception instanceof HttpExceptionInterface) { + // Avoid making a subrequest for 400 errors because the same conditions that + // caused the 400 error could also happen in the subrequest. This allows 400 + // exceptions to fall through to FinalExceptionSubscriber::on4xx. + if (($exception = $event->getThrowable()) && $exception instanceof HttpExceptionInterface && $exception->getStatusCode() > 400) { $this->makeSubrequest($event, '/system/4xx', $exception->getStatusCode()); } } - /** - * Handles a 400 error for HTML. - * - * @param \Symfony\Component\HttpKernel\Event\ExceptionEvent $event - * The event to process. - */ - public function on400(ExceptionEvent $event): void { - throw $event->getThrowable(); - } - /** * Handles a 401 error for HTML. * diff --git a/core/lib/Drupal/Core/Field/FieldUpdateActionBase.php b/core/lib/Drupal/Core/Field/FieldUpdateActionBase.php index ed184e9eb3f..a5a0f71b202 100644 --- a/core/lib/Drupal/Core/Field/FieldUpdateActionBase.php +++ b/core/lib/Drupal/Core/Field/FieldUpdateActionBase.php @@ -53,7 +53,7 @@ abstract class FieldUpdateActionBase extends ActionBase { $result = $object->access('update', $account, TRUE); foreach ($this->getFieldsToUpdate() as $field => $value) { - $result->andIf($object->{$field}->access('edit', $account, TRUE)); + $result = $result->andIf($object->{$field}->access('edit', $account, TRUE)); } return $return_as_object ? $result : $result->isAllowed(); diff --git a/core/modules/views/src/DisplayPluginCollection.php b/core/modules/views/src/DisplayPluginCollection.php index 74b69103d66..41eb2dc76e6 100644 --- a/core/modules/views/src/DisplayPluginCollection.php +++ b/core/modules/views/src/DisplayPluginCollection.php @@ -5,6 +5,7 @@ namespace Drupal\views; use Drupal\Component\Plugin\Exception\PluginException; use Drupal\Component\Plugin\PluginManagerInterface; use Drupal\Core\Plugin\DefaultLazyPluginCollection; +use Drupal\views\Plugin\views\display\DisplayPluginInterface; /** * A class which wraps the displays of a view so you can lazy-initialize them. @@ -59,7 +60,9 @@ class DisplayPluginCollection extends DefaultLazyPluginCollection { */ public function clear() { foreach (array_filter($this->pluginInstances) as $display) { - $display->destroy(); + if ($display instanceof DisplayPluginInterface) { + $display->destroy(); + } } parent::clear(); diff --git a/core/modules/views/tests/src/FunctionalJavascript/ExposedFilterAJAXTest.php b/core/modules/views/tests/src/FunctionalJavascript/ExposedFilterAJAXTest.php index 6d61ecef80a..af7cad9e287 100644 --- a/core/modules/views/tests/src/FunctionalJavascript/ExposedFilterAJAXTest.php +++ b/core/modules/views/tests/src/FunctionalJavascript/ExposedFilterAJAXTest.php @@ -78,6 +78,14 @@ class ExposedFilterAJAXTest extends WebDriverTestBase { * Tests if exposed filtering via AJAX works for the "Content" View. */ public function testExposedFiltering(): void { + // Create an account that can update the sticky flag. + $user = $this->drupalCreateUser([ + 'access content overview', + 'administer nodes', + 'edit any page content', + ]); + $this->drupalLogin($user); + // Visit the View page. $this->drupalGet('admin/content'); diff --git a/core/tests/Drupal/KernelTests/Core/EventSubscriber/ExceptionLoggingSubscriberTest.php b/core/tests/Drupal/KernelTests/Core/EventSubscriber/ExceptionLoggingSubscriberTest.php index 77507fbf8c4..4b11967a333 100644 --- a/core/tests/Drupal/KernelTests/Core/EventSubscriber/ExceptionLoggingSubscriberTest.php +++ b/core/tests/Drupal/KernelTests/Core/EventSubscriber/ExceptionLoggingSubscriberTest.php @@ -9,7 +9,6 @@ use Drupal\Core\Logger\RfcLogLevel; use Drupal\KernelTests\KernelTestBase; use Symfony\Component\ErrorHandler\BufferingLogger; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Exception\HttpException; /** * Tests that HTTP exceptions are logged correctly. @@ -64,9 +63,7 @@ class ExceptionLoggingSubscriberTest extends KernelTestBase { public static function exceptionDataProvider(): array { return [ - // When a BadRequestException is thrown, DefaultHttpExceptionSubscriber - // will rethrow the exception. - [400, 'client error', RfcLogLevel::WARNING, HttpException::class], + [400, 'client error', RfcLogLevel::WARNING], [401, 'client error', RfcLogLevel::WARNING], [403, 'access denied', RfcLogLevel::WARNING], [404, 'page not found', RfcLogLevel::WARNING],