diff --git a/core/lib/Drupal/Core/Template/TwigSandboxPolicy.php b/core/lib/Drupal/Core/Template/TwigSandboxPolicy.php index 5423bde..a7bb43f 100644 --- a/core/lib/Drupal/Core/Template/TwigSandboxPolicy.php +++ b/core/lib/Drupal/Core/Template/TwigSandboxPolicy.php @@ -81,8 +81,10 @@ public function checkPropertyAllowed($obj, $property) {} * {@inheritdoc} */ public function checkMethodAllowed($obj, $method) { - if (isset($this->whitelisted_classes[get_class($obj)])) { - return TRUE; + foreach ($this->whitelisted_classes as $class => $key) { + if ($obj instanceof $class) { + return TRUE; + } } // Return quickly for an exact match of the method name.