8000 [4.2] [TwigBundle] Twig bridge uses the contracts package without requiring it · Issue #29086 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content 8000
[4.2] [TwigBundle] Twig bridge uses the contracts package without requiring it #29086
Closed
@derrabus

Description

@derrabus

Symfony version(s) affected: 4.2.0-beta1

Description
It is possible to install TwigBundle without Symfony's new contracts package, but the bundle will register a Twig extension from the Twig bridge package for the translator that uses a trait from the contracts. Under certain circumstances, this will trigger a fatal error during cache warmup or template rendering.

How to reproduce
Reproducer: https://github.com/derrabus/symfony-reproducers/tree/bug/twig-without-contracts

If you run the application, you should get an exception on the / route.

screenshot_2018-11-04 attempted to call an undefined method named dotrans of class symfony bridge twig extension translatio

Possible Solution
Add the symfony/contracts package to the dependencies of either symfony/twig-bridge or symfony/twig-bundle or remove the trait usage from Symfony\Bridge\Twig\Extension\TranslationExtension.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0