Skip to content

[Twig/cache] Invalid value for _self special variable depending on cache generation method #61099

Open
@COil

Description

@COil

Symfony version(s) affected

  • 7.3.0
  • 7.3.1
  • 6.4.23

Description

Hello,

I notice weird behaviors with the Twig _self special variable:

rm -rf ./var/cache/*

Then I generate the cache with the browser, I get :

    <pre>
    _self : {{ _self }}
    </pre>

_self : App\Controller\HomeAction.html.twig

If I warm the cache with the CLI:

rm -rf ./var/cache/*
bin/console cache:warmup

When reloading the page, I get:

App/Controller/HomeAction.html.twig

We have slashes instead of backslashes this time.

I am on macOS.

How to reproduce

Possible Solution

No response

Additional Context

I was trying to use _self as a translation prefix and I noticed this weird behavior.

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