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

elimw created an issue. See original summary.

elimw’s picture

StatusFileSize
new892 bytes
elimw’s picture

Status: Active » Needs review
iyyappan.govind’s picture

StatusFileSize
new6.61 KB

Hi elimw,

Thanks for the patch. Why we shouldn't use EntityInterface in getEntityLink() as a parameter class. Please find the patch.

Thanks

iyyappan.govind’s picture

StatusFileSize
new907 bytes

Sorry added the wrong patch. Here is the correct one. Thanks

iyyappan.govind’s picture

Priority: Normal » Major
pcate’s picture

The patch fixed the error for me.

pcate’s picture

Status: Needs review » Reviewed & tested by the community
iyyappan.govind’s picture

gngn’s picture

Th 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.

smustgrave’s picture

Status: Reviewed & tested by the community » Closed (duplicate)