This commit is contained in:
Christian Flothmann
2024-08-28 14:17:54 +02:00
parent d379eef2aa
commit 8663ec242b
3 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -869,7 +869,7 @@ determine how to convert the code to PHP:
{# it is converted to the following PHP code: (6 & 2) || (6 & 16) #} {# it is converted to the following PHP code: (6 & 2) || (6 & 16) #}
Change the default precedence by explicitely grouping expressions with parentheses: Change the default precedence by explicitly grouping expressions with parentheses:
.. code-block:: twig .. code-block:: twig
+2 -2
View File
@@ -69,9 +69,9 @@ final class SecurityPolicy implements SecurityPolicyInterface
foreach ($tags as $tag) { foreach ($tags as $tag) {
if (!\in_array($tag, $this->allowedTags)) { if (!\in_array($tag, $this->allowedTags)) {
if ('extends' === $tag) { if ('extends' === $tag) {
trigger_deprecation('twig/twig', '3.12', 'The "extends" tag is always allowed in sandboxes, but won\'t be in 4.0, please enable it explicitely in your sandbox policy if needed.'); trigger_deprecation('twig/twig', '3.12', 'The "extends" tag is always allowed in sandboxes, but won\'t be in 4.0, please enable it explicitly in your sandbox policy if needed.');
} elseif ('use' === $tag) { } elseif ('use' === $tag) {
trigger_deprecation('twig/twig', '3.12', 'The "use" tag is always allowed in sandboxes, but won\'t be in 4.0, please enable it explicitely in your sandbox policy if needed.'); trigger_deprecation('twig/twig', '3.12', 'The "use" tag is always allowed in sandboxes, but won\'t be in 4.0, please enable it explicitly in your sandbox policy if needed.');
} else { } else {
throw new SecurityNotAllowedTagError(\sprintf('Tag "%s" is not allowed.', $tag), $tag); throw new SecurityNotAllowedTagError(\sprintf('Tag "%s" is not allowed.', $tag), $tag);
} }
+1 -1
View File
@@ -110,7 +110,7 @@ class SandboxTest extends TestCase
*/ */
public function testSandboxForExtendsAndUseTags(string $tag, string $template) public function testSandboxForExtendsAndUseTags(string $tag, string $template)
{ {
$this->expectDeprecation(sprintf('Since twig/twig 3.12: The "%s" tag is always allowed in sandboxes, but won\'t be in 4.0, please enable it explicitely in your sandbox policy if needed.', $tag)); $this->expectDeprecation(sprintf('Since twig/twig 3.12: The "%s" tag is always allowed in sandboxes, but won\'t be in 4.0, please enable it explicitly in your sandbox policy if needed.', $tag));
$twig = $this->getEnvironment(true, [], self::$templates, []); $twig = $this->getEnvironment(true, [], self::$templates, []);
$twig->createTemplate($template, 'index')->render([]); $twig->createTemplate($template, 'index')->render([]);