artgris / FileManagerBundle

FileManager is a simple Multilingual File Manager Bundle for Symfony
MIT License
171 stars 89 forks source link

Remove Twig\Extension\StringLoaderExtension from services.yml #82

Closed daninr closed 3 years ago

daninr commented 3 years ago

Hi,

I updated from Symfony 4.2 to 4.4 and now I can't get working this bundle because since Symfony 4.3 Twig\Extension\StringLoaderExtension is loaded by default.

This is the error I am getting:

image

Could you remove it from services.yml file?

artgris commented 3 years ago

Hi, I just tested with a new fresh Symfony 4.4 installation and I have no errors.

template_from_string function with StringLoaderExtension don't seem to be by default in symfony :

https://twig.symfony.com/doc/2.x/functions/template_from_string.html https://symfony.com/doc/4.4/reference/twig_reference.html

daninr commented 3 years ago

Hi @artgris thanks for you fast reply.

It is loaded with twig: https://twig.symfony.com/doc/3.x/api.html

image

If I remove:

Twig\Extension\StringLoaderExtension: ~

on your services.yml then it's working.

artgris commented 3 years ago

but it is not loaded by default:

https://twig.symfony.com/doc/3.x/functions/template_from_string.html : The template_from_string function is not available by default. You must add the \Twig\Extension\StringLoaderExtension extension explicitly when creating your Twig environment

you probably already have a declaration (override/extend) of this extension, in your project, for example:

    app.extension:
        class: Twig\Extension\StringLoaderExtension
        tags:
            - { name: 'twig.extension' }

and should be removed or replace by:

Twig\Extension\StringLoaderExtension: ~