From 2763876c725e190534ab993f1867d80ce6d221ac Mon Sep 17 00:00:00 2001 From: catch <catch@35733.no-reply.drupal.org> Date: Fri, 22 Jan 2021 17:28:53 +0000 Subject: [PATCH] Issue #3193771 by larowlan, sk_10, quietone: Drupal\Component\Plugin\Exception\PluginNotFoundException: The "'"--><" entity type does not exist (cherry picked from commit 26130ff27355b41efbf645ea0a8246c9e858774e) --- .../Core/ParamConverter/AdminPathConfigEntityConverter.php | 4 +++- .../comment/tests/src/Functional/CommentInterfaceTest.php | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/lib/Drupal/Core/ParamConverter/AdminPathConfigEntityConverter.php b/core/lib/Drupal/Core/ParamConverter/AdminPathConfigEntityConverter.php index 5fbaa3fbf4d0..790f32b5bcf1 100644 --- a/core/lib/Drupal/Core/ParamConverter/AdminPathConfigEntityConverter.php +++ b/core/lib/Drupal/Core/ParamConverter/AdminPathConfigEntityConverter.php @@ -63,7 +63,9 @@ public function __construct(EntityTypeManagerInterface $entity_type_manager, Con */ public function convert($value, $definition, $name, array $defaults) { $entity_type_id = $this->getEntityTypeFromDefaults($definition, $name, $defaults); - + if (!$this->entityTypeManager->hasDefinition($entity_type_id)) { + return NULL; + } // If the entity type is dynamic, confirm it to be a config entity. Static // entity types will have performed this check in self::applies(). if (strpos($definition['type'], 'entity:{') === 0) { diff --git a/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php b/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php index 8b64d11a43a0..52d1c3b61cf7 100644 --- a/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php +++ b/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php @@ -53,6 +53,10 @@ public function testCommentInterface() { $comment = $this->postComment($this->node, $comment_text); $this->assertTrue($this->commentExists($comment), 'Comment found.'); + // Test that using an invalid entity-type does not raise an error. + $this->drupalGet('comment/reply/yeah-this-is-not-an-entity-type/' . $this->node->id() . '/comment/' . $comment->id()); + $this->assertSession()->statusCodeEquals(404); + // Test the comment field title is displayed when there's comments. $this->drupalGet($this->node->toUrl()); $this->assertSession()->responseMatches('@<h2[^>]*>Comments</h2>@'); -- GitLab