issue 696: TemplateHandler now supports eval()

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9952 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
taggon 2011-12-14 09:31:34 +00:00
parent 05cd0d720d
commit d25f1cf768
2 changed files with 6 additions and 1 deletions

View file

@ -565,7 +565,7 @@ class TemplateHandler {
**/
function _replaceVar($php) {
if(!strlen($php)) return '';
return preg_replace('@(?<!::|\\\\|\')\$([a-z]|_[a-z0-9])@i', '\$__Context->$1', $php);
return preg_replace('@(?<!::|\\\\|(?<!eval\()\')\$([a-z]|_[a-z0-9])@i', '\$__Context->$1', $php);
}
}

View file

@ -227,6 +227,11 @@ class TemplateHandlerTest extends PHPUnit_Framework_TestCase
'<img src="../myxe/xe/img.png" />',
'<img src="/xe/tests/classes/myxe/xe/img.png" />'
),
// issue 696
array(
'{@ eval(\'$val = $document_srl;\')}',
'<?php eval(\'$__Context->val = $__Context->document_srl;\') ?>'
),
);
}