fixed EscaperNodeVisitor

This commit is contained in:
Fabien Potencier
2019-04-16 18:55:59 +02:00
parent 072c628620
commit a3fc63923a
3 changed files with 10 additions and 2 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
* 1.39.1 (2019-XX-XX)
* n/a
* fixed EscaperNodeVisitor
* 1.39.0 (2019-04-16)
+1 -1
View File
@@ -108,7 +108,7 @@ class EscaperNodeVisitor extends AbstractNodeVisitor
$expr2 = $this->escapeInlinePrintNode(new InlinePrint($expr2, $expr2->getTemplateLine()), $env, $type);
}
$expr3 = $expression->getNode('expr3');
if ($expr3 instanceof ConditionalExpression && $this->shouldUnwrapConditional($expr2, $env, $type)) {
if ($expr3 instanceof ConditionalExpression && $this->shouldUnwrapConditional($expr3, $env, $type)) {
$expr3 = $this->unwrapConditional($expr3, $env, $type);
} else {
$expr3 = $this->escapeInlinePrintNode(new InlinePrint($expr3, $expr3->getTemplateLine()), $env, $type);
@@ -23,12 +23,16 @@
{{ true ? (false ? "<br />" : someVar) : "\n" }}
{{ true ? (true ? someVar : "<br />") : "\n" }}
{{ true ? (false ? someVar : "<br />") : "\n" }}
{{ false ? "\n" : (true ? someVar : "<br />") }}
{{ false ? "\n" : (false ? someVar : "<br />") }}
6. Nested conditionals with a variable marked safe
{{ true ? (true ? "<br />" : someVar|raw) : "\n" }}
{{ true ? (false ? "<br />" : someVar|raw) : "\n" }}
{{ true ? (true ? someVar|raw : "<br />") : "\n" }}
{{ true ? (false ? someVar|raw : "<br />") : "\n" }}
{{ false ? "\n" : (true ? someVar|raw : "<br />") }}
{{ false ? "\n" : (false ? someVar|raw : "<br />") }}
7. Without then clause
{{ "<br />" ?: someVar }}
@@ -63,12 +67,16 @@ return ['someVar' => '<br />', 'someFalseVar' => false]
&lt;br /&gt;
&lt;br /&gt;
<br />
&lt;br /&gt;
<br />
6. Nested conditionals with a variable marked safe
<br />
<br />
<br />
<br />
<br />
<br />
7. Without then clause
<br />