After running a security review and trying to view details of the "Dangerous tags were found in submitted content (fields)." check, I got the following error:
The website encountered an unexpected error. Please try again later.
TypeError: Argument 1 passed to Drupal\security_review\Checks\Field::getEntityLink() must be an instance of Drupal\Core\Entity\Entity, instance of Drupal\block_content\Entity\BlockContent given, called in /var/www/xxx/docroot/modules/contrib/security_review/src/Checks/Field.php on line 141 in Drupal\security_review\Checks\Field->getEntityLink() (line 166 of modules/contrib/security_review/src/Checks/Field.php).
Drupal\security_review\Checks\Field->getEntityLink(Object) (Line: 141)
Drupal\security_review\Checks\Field->evaluate(Object) (Line: 195)
Drupal\security_review\Controller\HelpController->checkHelp('security_review', 'field') (Line: 86)
Drupal\security_review\Controller\HelpController->index('security_review', 'field')
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 87)
Drupal\utilities\StackMiddleware\UtilitiesMiddleware->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 693)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
This is due to Drupal\security_review\Checks\Field::getEntityLink() using the deprecated Entity class for it's first argument.
Comments
Comment #2
elimw commentedComment #3
elimw commentedComment #4
iyyappan.govindHi elimw,
Thanks for the patch. Why we shouldn't use
EntityInterfaceingetEntityLink()as a parameter class. Please find the patch.Thanks
Comment #5
iyyappan.govindSorry added the wrong patch. Here is the correct one. Thanks
Comment #6
iyyappan.govindComment #7
pcate commentedThe patch fixed the error for me.
Comment #8
pcate commentedComment #9
iyyappan.govindComment #10
gngn commentedTh current 8.x-1.0-alpha1 contains a fix for this - see #3127304-3: PHP fatal when viewing details of `Dangerous tags were found...`.
So I think this is a duplicate.
Comment #11
smustgrave commentedThis is a duplicate of https://www.drupal.org/project/security_review/issues/3127304#comment-13... moving over credit.