Treat $_SESSION specially in template code

https://xetown.com/questions/1522739
This commit is contained in:
Kijin Sung 2021-02-04 15:58:32 +09:00
parent 0d74df4dc4
commit 76c6ef56f2

View file

@ -1039,7 +1039,7 @@ class TemplateHandler
}
return preg_replace_callback('@(?<!::|\\\\|(?<!eval\()\')\$([a-z_][a-z0-9_]*)@i', function($matches) {
if (preg_match('/^(?:GLOBALS|_SERVER|_COOKIE|_GET|_POST|_REQUEST|__Context|this|lang)$/', $matches[1]))
if (preg_match('/^(?:GLOBALS|_SERVER|_COOKIE|_GET|_POST|_REQUEST|_SESSION|__Context|this|lang)$/', $matches[1]))
{
return '$' . $matches[1];
}