主要在includes/cls_template.php 文件中:
1.288行左右
源语句:
return preg_replace("/{([^\}\{\n]*)}/e", "\$this->select('\\1');", $source);
修改为
return preg_replace_callback("/{([^\}\{\n]*)}/", function($r) { return $this->select($r[1]); }, $source);
2.482附近
原语句:
$out = " . '$k = ' . preg_replace("/(\'\\$[^,]+)/e" , "stripslashes(trim('\\1','\''));", var_export($t, true)) . ";\n";
修改为:
$replacement = preg_replace_callback("/(\'\\$[^,]+)/" ,
function($matcher){
return stripslashes(trim($matcher[1],'\''));
},
var_export($t, true));
$out = "
3.550行附近
原语句:
$val = preg_replace("/\[([^\[\]]*)\]/eis", "'.'.str_replace('$','\$','\\1')", $val);
修改为:
$val = preg_replace_callback("/\[([^\[\]]*)\]/is",
function ($matcher) {
return '.'.str_replace('$','\$',$matcher[1]);
}, $val);
4.1071行附近
原语句:
$replacement = "'{include file='.strtolower('\\1'). '}'";
$source = preg_replace($pattern, $replacement, $source);
修改为:
$source = preg_replace_callback($pattern,
function ($matcher) {
return '{include file=' . strtolower($matcher[1]). '}';
},
$source);
同时把
$pattern = '/.*?/es';
/es中的e去掉