mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-05 06:56:51 +00:00
fixed EscaperNodeVisitor
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
* 1.39.1 (2019-XX-XX)
|
||||
|
||||
* n/a
|
||||
* fixed EscaperNodeVisitor
|
||||
|
||||
* 1.39.0 (2019-04-16)
|
||||
|
||||
|
||||
@@ -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]
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
|
||||
6. Nested conditionals with a variable marked safe
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
|
||||
7. Without then clause
|
||||
<br />
|
||||
|
||||
Reference in New Issue
Block a user