TypeError: Drupal\twig_tweak\TwigTweakExtension::drupalEntity(): Argument #2 ($selector) must be of type string, null given

Created on 20 January 2024, about 1 year ago

Problem/Motivation

The website encountered an unexpected error. Please try again later.
TypeError: Drupal\twig_tweak\TwigTweakExtension::drupalEntity(): Argument #2 ($selector) must be of type string, null given, called in /var/www/born/vendor/twig/twig/src/Environment.php(418) : eval()'d code on line 1133 in Drupal\twig_tweak\TwigTweakExtension::drupalEntity() (line 160 of modules/contrib/twig_tweak/src/TwigTweakExtension.php).

Steps to reproduce

I found issues after upgrade Drupal 9.2 to 9.5 and current version of module twig_tweak: 3.2

🐛 Bug report
Status

Active

Version

3.2

Component

Code

Created by

🇮🇳India amit.drupal

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

Comments & Activities

  • Issue created by @amit.drupal
  • Issue was unassigned.
  • Status changed to Needs review about 1 year ago
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.x + Environment: PHP 8.1 & MariaDB 10.3.22
    last update about 1 year ago
    Patch Failed to Apply
  • 🇮🇳India amit.drupal

    Patch is created. Please review

  • Status changed to Postponed: needs info about 1 year ago
  • 🇷🇺Russia Chi

    What's the point to call `drupalEntity` without entity ID?

  • 🇺🇸United States annie2512

    I am getting this same error. I am on drupal 9.5.11 and just updated twig_tweak to 3.2
    When I logged in to the very first time, I got this error. On subsequent logins, there is no problem

  • 🇺🇸United States annie2512

    I am having too many problems with version 3,2. When I try to rever tot he old version I am not able to. Is it not possible to revert?

  • 🇷🇺Russia Chi

    You can install whatever version of Twig Tweak compatible with your Drupal installation.

  • 🇪🇸Spain pgrandeg

    Still happening here with Drupal 9.5 and twig_tweak 3.3.0, patch rerrolled

  • Status changed to Needs review 9 days ago
  • 🇫🇷France tostinni

    What's the point to call `drupalEntity` without entity ID?

    @chi you're right, this is bad programming, however previous versions weren't breaking on this error (also due to stricter requirement in PHP 8), so I guess these kind of errors may exists in older code base and this patch help prevent a site from breaking.

Production build 0.71.5 2024