Twig\Error\SyntaxError: Unexpected token "operator" of value

Created on 27 November 2023, about 1 year ago
Updated 21 December 2023, 12 months ago

Problem/Motivation

This causes a full 500 Service unavailable and makes the site unusable. The following log entries appear:

Type: php
Message: 	Twig\Error\SyntaxError: Unexpected token "operator" of value "-" ("end of statement block" expected). in Twig\TokenStream->expect() (line 33 of themes/contrib/radix/components/views-view/views-view.twig).
Severity: Error 

Steps to reproduce

Composer to install clean Drupal 10.1.6.
Enable required components (Single Directory Components, Serialization)
Composer to install Radix: composer require 'drupal/radix:^6.0@beta'
Enable the theme and set to default.

Happy to debug on my site if someone wants to lend some guidance on what is needed.

Remaining work

Apply same changes to navbar-brand.twig

🐛 Bug report
Status

Fixed

Version

6.0

Component

Code

Created by

🇺🇸United States Gorf

Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Issue created by @Gorf
  • First commit to issue fork.
  • Status changed to Needs review about 1 year ago
  • 🇮🇳India viren18febS

    I have fixed the above issue & added patch, please review.

  • Status changed to Needs work about 1 year ago
  • 🇮🇳India SandeepSingh199

    @viren18febS, I reviewed #4 patch and its throwing other issue.

  • 🇺🇸United States boinkster

    Working though templates with the fix suggested in #7, eventually leads to:

    TypeError: Unsupported operand types: null - array in __TwigTemplate_7c900ea4bd68698dd0a963aeeff08683->doDisplay() (line 47 of /var/www/html/vendor/twig/twig/src/Environment.php(361) : eval()'d code).

  • 🇺🇸United States anilu@ Houston, TX

    You need to remove every navbar-brand_ in utility_classes

  • 🇺🇸United States boinkster

    Still throws the same error after changing every navbar-brand_utility_classes to utility_classes in navbar-brand.twig

  • This is becoming a mess with the utility_classes, I have two options:
    1. Make every utility class of every component named just: utility_classes
    2. What we have at the moment (but fix the problem) and name: [component-name]_utility_classes

    I wonder if the first option makes more sense here, any pros and cons worth sharing, love to hear what you guys think

  • 🇺🇸United States boinkster

    I'm new to SDC so don't have knowledge of whether utility_classes everywhere would be an issue down the road.

  • 🇺🇸United States boinkster

    It's unclear to me what is happening with the twig utility_classes ternary statement and subsequent classes merge. How does a value get passed in to utility_classes and why would you need to?

  • Status changed to Fixed about 1 year ago
  • Okay thank you all for helping out on this, it was a naming convention issue causing the breakdown. pushed a fix and tagged a new beta3 release.
    crediting all

  • Automatically closed - issue fixed for 2 weeks with no activity.

  • 🇺🇸United States anilu@ Houston, TX

    Awesome @doxigo thanks!

  • Status changed to Fixed 12 months ago
  • 🇺🇸United States anilu@ Houston, TX
Production build 0.71.5 2024