diff --git a/core/lib/Drupal/Core/EventSubscriber/ExceptionLoggingSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/ExceptionLoggingSubscriber.php index ace8fd715b..8f2d932195 100644 --- a/core/lib/Drupal/Core/EventSubscriber/ExceptionLoggingSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/ExceptionLoggingSubscriber.php @@ -61,7 +61,7 @@ public function on404(ExceptionEvent $event) { /** * Log 4xx errors. * - * @param \Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent $event + * @param \Symfony\Component\HttpKernel\Event\ExceptionEvent $event * The event to process. */ public function on4xx(ExceptionEvent $event) { diff --git a/core/modules/dblog/tests/src/Functional/DbLogTest.php b/core/modules/dblog/tests/src/Functional/DbLogTest.php index e0d212a846..0211fe6f0c 100644 --- a/core/modules/dblog/tests/src/Functional/DbLogTest.php +++ b/core/modules/dblog/tests/src/Functional/DbLogTest.php @@ -902,19 +902,20 @@ public function testBacktrace() { } /** - * Tests that 4xx exceptions are reported in logs correctly. + * Tests that a 4xx errors are logged as a '4xx error'. */ public function test4xxExceptionHandling() { // Create a node. $this->drupalCreateContentType(['type' => 'article']); $node = $this->drupalCreateNode(['type' => 'article', 'title' => 'Test article']); - // 4xx exceptions that are not handled should not be logged as php errors. + // Create a uri that will cause a 406 error. $uri = $node->toUrl('canonical', [ 'query' => ['_format' => 'hal_json'], ]); $this->drupalGet($uri); + // Confirm that a php error was not logged and that a 4xx error was. $php = Database::getConnection()->query("SELECT * FROM {watchdog} WHERE type='php'")->fetchAll(); $fxx = Database::getConnection()->query("SELECT * FROM {watchdog} WHERE type='4xx error'")->fetchAll(); $this->assertCount(0, $php);