Yii2-twig extension problem (undefined function twig_get_attribute())

Yii2 version 2.0.49, PHP 8.2
I installed the yiisoft/yii2-twig extension version 2.4.2
When I render the template, I get an error

Twig\\Error\\RuntimeError
Call to undefined function twig_get_attribute()

The only reference to this function I found in the file: vendor/yiisoft/yii2-twig/src/Template.php

public static function attribute(...)
{
.... 
 return \twig_get_attribute($env, $source, $object, $item, $arguments, $type, $isDefinedTest, $ignoreStrictCheck);
}

Do you need some additional PHP extension to make Twig work?
Please help…

1 Like

Try downgrading your twig (this worked for me)

composer require "twig/twig:3.8.0"

Obviously, that is just a temporary patch - let’s hope for a proper fix to come along soon