Fix sandbox __toString bypasses

This commit is contained in:
Fabien Potencier
2026-05-19 16:49:38 +02:00
parent 7f3056a28e
commit 447d0b2331
35 changed files with 516 additions and 67 deletions
+7 -1
View File
@@ -28,7 +28,7 @@ use Twig\Source;
* @author Fabien Potencier <fabien@symfony.com>
*/
#[YieldReady]
final class ModuleNode extends Node
final class ModuleNode extends Node implements CoercesChildrenToStringInterface
{
/**
* @param BodyNode $body
@@ -90,6 +90,12 @@ final class ModuleNode extends Node
}
}
public function getStringCoercedChildNames(): array
{
// the parent expression is resolved through the loader, which coerces it to a string
return $this->hasNode('parent') ? ['parent'] : [];
}
/**
* @return void
*/