mirror of
https://github.com/twigphp/Twig.git
synced 2026-10-09 21:35:40 +00:00
Fix sandbox __toString bypasses
This commit is contained in:
@@ -23,7 +23,7 @@ use Twig\Node\Expression\Variable\ContextVariable;
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
*/
|
||||
#[YieldReady]
|
||||
class ImportNode extends Node
|
||||
class ImportNode extends Node implements CoercesChildrenToStringInterface
|
||||
{
|
||||
public function __construct(AbstractExpression $expr, AbstractExpression|AssignTemplateVariable $var, int $lineno)
|
||||
{
|
||||
@@ -58,4 +58,10 @@ class ImportNode extends Node
|
||||
|
||||
$compiler->raw(";\n");
|
||||
}
|
||||
|
||||
public function getStringCoercedChildNames(): array
|
||||
{
|
||||
// the loader resolves the template-name expression by coercing it to a string
|
||||
return ['expr'];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user