diff --git a/common/framework/parsers/template/TemplateParser_v2.php b/common/framework/parsers/template/TemplateParser_v2.php index 12593e223..be1861810 100644 --- a/common/framework/parsers/template/TemplateParser_v2.php +++ b/common/framework/parsers/template/TemplateParser_v2.php @@ -285,8 +285,15 @@ class TemplateParser_v2 */ protected function _convertVerbatimSections(string $content): string { - $content = preg_replace_callback('#(@verbatim)\b(.+?)(@endverbatim)\b#s', function($match) { - return preg_replace(['#(? '{$1}', + '#(? '@{{', + '#(? '@@$1', + '#\$#' => '$', + ]; + + $content = preg_replace_callback('#(@verbatim)\b(.+?)(@endverbatim)\b#s', function($match) use($conversions) { + return preg_replace(array_keys($conversions), array_values($conversions), $match[2]); }, $content); return $content; } diff --git a/tests/unit/framework/parsers/TemplateParserV2Test.php b/tests/unit/framework/parsers/TemplateParserV2Test.php index 72bcda4ee..5ea0a40f9 100644 --- a/tests/unit/framework/parsers/TemplateParserV2Test.php +++ b/tests/unit/framework/parsers/TemplateParserV2Test.php @@ -1015,6 +1015,7 @@ class TemplateParserV2Test extends \Codeception\Test\Unit '@verbatim', '@if (true)', '

{{ $foobar }}

', + '

{$foobar}

', '@endif', '@endverbatim', ]); @@ -1022,6 +1023,7 @@ class TemplateParserV2Test extends \Codeception\Test\Unit '', '@if (true)', '

{{ $foobar }}

', + '

{$foobar}

', '@endif', '', ]);