Fix issue LogicException: Attribute "name" does not exist for Node "Twig\Node\Expression\GetAttrExpression".

Created on 26 February 2025, about 2 months ago

Problem/Motivation

Installing the module with Drupal 11 causes an error when accessing the following page: /admin/reports/ui-components.

The website encountered an unexpected error. Try again later.

LogicException: Attribute "name" does not exist for Node "Twig\Node\Expression\GetAttrExpression". in Twig\Node\Node->getAttribute() (line 158 of /var/www/html/vendor/twig/twig/src/Node/Node.php).
Drupal\sdc_devel\Plugin\TwigValidatorRule\TwigValidatorRuleNode->checkIfVariableName() (Line: 69)
Drupal\sdc_devel\Plugin\TwigValidatorRule\TwigValidatorRuleNode->processNode() (Line: 43)
Drupal\sdc_devel\TwigValidator\TwigRulePluginVisitor->enterNode() (Line: 62)
Twig\NodeTraverser->traverseForVisitor() (Line: 65)
Twig\NodeTraverser->traverseForVisitor() (Line: 65)
Twig\NodeTraverser->traverseForVisitor() (Line: 65)
Twig\NodeTraverser->traverseForVisitor() (Line: 65)
Twig\NodeTraverser->traverseForVisitor() (Line: 65)
Twig\NodeTraverser->traverseForVisitor() (Line: 53)
Twig\NodeTraverser->traverse() (Line: 136)
Drupal\sdc_devel\TwigValidator\TwigValidator->processSource() (Line: 74)
Drupal\sdc_devel\TwigValidator\TwigValidator->validateComponent() (Line: 45)
Drupal\sdc_devel\Validator->validateComponent() (Line: 37)
Drupal\sdc_devel\Validator->validate() (Line: 212)
Drupal\sdc_devel\Controller\ComponentValidatorOverview->getComponentMessages() (Line: 111)
Drupal\sdc_devel\Controller\ComponentValidatorOverview->overview()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 593)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 183)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 53)
Asm89\Stack\Cors->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 709)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Proposed resolution

Update the checkIfVariableName function to verify whether the attribute exists or not.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇯🇴Jordan Qusai Taha Amman

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024