Skip to content

Commit

Permalink
make compatible with twig 3.9, twig_get_attribute is now internal func (
Browse files Browse the repository at this point in the history
  • Loading branch information
jtallant committed Apr 24, 2024
1 parent 4c25664 commit e0b2b67
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Node/GetAttrNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Twig\Compiler;
use Twig\Environment;
use Twig\Error\RuntimeError;
use Twig\Extension\CoreExtension;
use Twig\Extension\SandboxExtension;
use Twig\Node\Expression\GetAttrExpression;
use Twig\Node\Node;
Expand Down Expand Up @@ -144,6 +145,12 @@ public static function attribute(
return $object->$item;
}

// Note: Since twig:3.9 the 'twig_get_attribute' function was renamed to CoreExtension::getAttribute.
// Because this is an internal function of twig, the authors could break it in a minor version.
if (!function_exists('twig_get_attribute')) {
return CoreExtension::getAttribute($env, $source, $object, $item, $arguments, $type, $isDefinedTest, $ignoreStrictCheck);
}

return \twig_get_attribute(
$env,
$source,
Expand Down

0 comments on commit e0b2b67

Please sign in to comment.