mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-14 11:27:00 +00:00
use str_replace instead of strtr to escape the source in the template
This commit is contained in:
@@ -641,7 +641,7 @@ class Twig_Environment
|
||||
$compiled = $this->compile($this->parse($this->tokenize($source, $name)), $source);
|
||||
|
||||
if (isset($source[0])) {
|
||||
$compiled .= '/* '.strtr($source, array('*/' => '*//*', "\r\n" => "*/\n/* ", "\r" => "*/\n/* ", "\n" => "*/\n/* "))."*/\n";
|
||||
$compiled .= '/* '.str_replace(array('*/', "\r\n", "\n", "\r"), array('*//*', "\n", "*/\n/* ", "*/\n/* "), $source)."*/\n";
|
||||
}
|
||||
|
||||
return $compiled;
|
||||
|
||||
@@ -233,7 +233,7 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderI
|
||||
|
||||
protected function normalizeName($name)
|
||||
{
|
||||
return preg_replace('#/{2,}#', '/', strtr((string) $name, '\\', '/'));
|
||||
return preg_replace('#/{2,}#', '/', str_replace('\\', '/', (string) $name));
|
||||
}
|
||||
|
||||
protected function validateName($name)
|
||||
|
||||
Reference in New Issue
Block a user