Skip to content

Messenger workers crash with UndefinedMethodError: TwigDecorator::reset() on Shopware >= 6.7.x #85

Description

@kathi-at-datrycs

PHP Version

8.4

Shopware Version

6.7.14.0

Plugin Version

3.0.1

Actual behaviour

The async message queue constantly stopped with FATAL. Supervisor error logs showed

In ServicesResetter.php line 60:
                                                                               
  [Symfony\Component\ErrorHandler\Error\UndefinedMethodError]                  
  Attempted to call an undefined method named "reset" of class "Frosh\Develop  
  mentHelper\Component\Profiler\TwigDecorator".                                
  Did you mean to call "resetGlobals"? 

Expected behaviour

The async message queue runs without errors.

What we did to fix this:
We patched src/Component/Profiler/TwigDecorator.php

-use Twig\Environment;
+use Shopware\Core\Framework\Adapter\Twig\TwigEnvironment;

-class TwigDecorator extends Environment
+class TwigDecorator extends TwigEnvironment

Steps to Reproduce?

  1. Set up a Shopware 6.7.14.0 project (or any version containing fix(core): Move clearing of Twig escape cache to TwigEnvironment shopware/shopware#19304) with APP_ENV=dev
  2. composer require --dev frosh/development-helper:3.0.1 and activate the plugin (bin/console plugin:install --activate --cacheClear FroshDevelopmentHelper)
  3. Dispatch any async message — e.g. let the task scheduler queue a scheduled task, or run bin/console scheduled-task:run --no-wait
  4. Consume it: bin/console messenger:consume async -vv
  5. The worker handles the message, then crashes with the UndefinedMethodError above (triggered by ResetServicesListener after the message is handled)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions