Merge pull request #1070 from cgx/fix/escape

Add backslashes before characters that need to be escaped
This commit is contained in:
Lucas Bartholemy 2015-06-07 19:48:19 +02:00
commit 102ca6b53b

View File

@ -41,7 +41,7 @@ class HClientScript extends CClientScript
public function setJavascriptVariable($name, $value)
{
$jsCode = "var " . $name . " = '" . $value . "';\n";
$jsCode = "var " . $name . " = '" . addslashes($value) . "';\n";
$this->registerScript('jsVar_' . $name, $jsCode, CClientScript::POS_BEGIN);
}