Fix nested JS contexts in template v2 #2646

This commit is contained in:
Kijin Sung 2026-01-06 23:43:21 +09:00
parent 6243b0321d
commit 26d645da4d

View file

@ -227,7 +227,7 @@ class TemplateParser_v2
{
$content = preg_replace_callback('#(<\?php \$this->config->context = \'JS\'; /\* !CTX([0-9]+)! \*/\?>)(.*?)(<\?php \$this->config->context = \'HTML\'; /\* !CTX\2! \*/\?>)#s', function($match) {
return preg_replace('#/\* !CTX\d+! \*/#', '', $match[1]) .
preg_replace('#<\?php \$this->config->context = \'[A-Z]+\'; \?>#', '', $match[3]) .
preg_replace('#<\?php \$this->config->context = \'[A-Z]+\'; (?:/\* !CTX[0-9]+! \*/)?\?>#', '', $match[3]) .
preg_replace('#/\* !CTX\d+! \*/#', '', $match[4]);
}, $content);