Closed barryp closed 2 months ago
So we just have to replace that call with \Twig\Extension\CoreExtension::getAttribute
right?
Seems like it.
I was just now looking for other twig_*() functions that TwigBridge was calling and didn't find any.
If you make that change then you'd have to require twig >= 3.9.0 because the CoreExtension::getAttribute()
isn't present in older twigs.
Faced the same issue, the workaround is to add that extra twig dependency at the root level instead of relying on TwigBridge to require it with the too broad ~3.0
, while TwigBridge's own requirement is fixed.
If you make that change then you'd have to require twig >= 3.9.0 because the
CoreExtension::getAttribute()
isn't present in older twigs.
Yes. But if you wanna keep backward compatibilty, just do:
if (! function_exists("twig_get_attribute")) {
function twig_get_attribute(
$env,
$source,
$object,
$item,
$arguments,
$type,
$isDefinedTest,
$ignoreStrictCheck,
$sandboxed,
$lineno
)
{
return \Twig\Extension\CoreExtension::getAttribute(
$env,
$source,
$object,
$item,
$arguments,
$type,
$isDefinedTest,
$ignoreStrictCheck,
$sandboxed,
$lineno);
}
}
This works btw as a hotfix as well until this packages gets an update ;)
This commit in Twig 3.9.0 https://github.com/twigphp/Twig/commit/54d34b969b256ecd1c7aa3416205206d87686ef7 removes functions that TwigBridge is using like the call to twig_get_attribute() from src/Node/GetAttrNode.php
I think some code is going to need to be rewritten. For now probably the thing to do is update twigbridge's composer.json to maybe require something like: