Skip to content

Commit c9a3728

Browse files
committed
Workaround for twigphp/Twig#4701
1 parent 7b0255d commit c9a3728

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/helpers/Template.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use craft\db\Paginator;
1313
use craft\web\twig\variables\Paginate;
1414
use craft\web\View;
15+
use Stringable;
1516
use Twig\Environment;
1617
use Twig\Error\RuntimeError;
1718
use Twig\Extension\CoreExtension;
@@ -145,6 +146,11 @@ public static function attribute(
145146
}
146147

147148
try {
149+
// workaround for https://github.com/twigphp/Twig/issues/4701
150+
if ($type !== TwigTemplate::METHOD_CALL && $item instanceof Stringable) {
151+
$item = (string) $item;
152+
}
153+
148154
return CoreExtension::getAttribute(
149155
$env,
150156
$source,

0 commit comments

Comments
 (0)