Commit 9fb7da89 by Jordi Boggiano

Fixed a double escaping bug when a variable was assigned to another one

parent 3d47f4c2
......@@ -28,6 +28,7 @@
it with caution
* Fixed PHP parse errors being generated in compiled templates when
{dynamic} was nested
* Fixed a double escaping bug when a variable was assigned to another one
* Added $this->viewParam support to ZendFramework adapter through a
Dwoo_Adapters_ZendFramework_Dwoo class that extends Dwoo, you should use
this if you called setEngine() on the ZF view
......
......@@ -2214,7 +2214,7 @@ class Dwoo_Compiler implements Dwoo_ICompiler
}
}
if ($this->autoEscape === true) {
if ($this->autoEscape === true && $curBlock !== 'condition') {
$output = '(is_string($tmp='.$output.') ? htmlspecialchars($tmp, ENT_QUOTES, $this->charset) : $tmp)';
}
......
......@@ -159,6 +159,16 @@ aaa
$this->dwoo->get($tpl, array());
}
public function testDoubleEscapingOnAssignments()
{
$tpl = new Dwoo_Template_String('{$bar = $foo}{$foo}{$bar}');
$tpl->forceCompilation();
$cmp = new Dwoo_Compiler();
$cmp->setAutoEscape(true);
$this->assertEquals('a'ba'b', $this->dwoo->get($tpl, array('foo' => "a'b"), $cmp));
}
}
function Dwoo_Plugin_X_compile(Dwoo_Compiler $cmp, $text)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment