Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[TwigBridge] function twig_test_empty is deprecated in Twig 3.9 #52987

Closed
@GromNaN

Description

@GromNaN

Symfony version(s) affected

5.4.31, 6.4.0, 7.0.0, 7.1

Description

The twig_* global functions are deprecated in Twig 3.9 twigphp/Twig#3883, and removed in Twig 4.0 twigphp/Twig#3937

The function twig_test_empty is used in Symfony\Bridge\Twig\Node\SearchAndRenderBlockNode:

if (!twig_test_empty($label->getAttribute('value'))) {

$compiler->raw('(twig_test_empty($_label_ = ');

How to reproduce

composer create-project symfony/demo
composer require "twig/twig: 3.x-dev"

Go to https://localhost:8000/fr/admin/post/1/edit

Deprecation message:

Since twig/twig 3.9.0: Using the internal "twig_test_empty" function is deprecated.

Possible Solution

Duplicate the function as a static method in SearchAndRenderBlockNode.

Additional Context

No response

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