diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateFilenameParser.php b/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateFilenameParser.php index befb3e8f8577..85825fe337f4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateFilenameParser.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateFilenameParser.php @@ -26,7 +26,7 @@ class TemplateFilenameParser implements TemplateNameParserInterface */ public function parse($file) { - $parts = explode('/', strtr($file, '\\', '/')); + $parts = explode('/', str_replace('\\', '/', $file)); $elements = explode('.', array_pop($parts)); if (3 > count($elements)) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateNameParser.php b/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateNameParser.php index 4777fbeadbb4..ea347bc82060 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateNameParser.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateNameParser.php @@ -50,7 +50,7 @@ public function parse($name) } // normalize name - $name = str_replace(':/', ':', preg_replace('#/{2,}#', '/', strtr($name, '\\', '/'))); + $name = str_replace(':/', ':', preg_replace('#/{2,}#', '/', str_replace('\\', '/', $name))); if (false !== strpos($name, '..')) { throw new \RuntimeException(sprintf('Template name "%s" contains invalid characters.', $name)); diff --git a/src/Symfony/Component/ClassLoader/Tests/ClassMapGeneratorTest.php b/src/Symfony/Component/ClassLoader/Tests/ClassMapGeneratorTest.php index e6756f1898d8..7bdf5aa0dc86 100644 --- a/src/Symfony/Component/ClassLoader/Tests/ClassMapGeneratorTest.php +++ b/src/Symfony/Component/ClassLoader/Tests/ClassMapGeneratorTest.php @@ -140,10 +140,10 @@ public function testCreateMapFinderSupport() protected function assertEqualsNormalized($expected, $actual, $message = null) { foreach ($expected as $ns => $path) { - $expected[$ns] = strtr($path, '\\', '/'); + $expected[$ns] = str_replace('\\', '/', $path); } foreach ($actual as $ns => $path) { - $actual[$ns] = strtr($path, '\\', '/'); + $actual[$ns] = str_replace('\\', '/', $path); } $this->assertEquals($expected, $actual, $message); } diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php index eea41dad666e..636942a693d6 100644 --- a/src/Symfony/Component/Filesystem/Filesystem.php +++ b/src/Symfony/Component/Filesystem/Filesystem.php @@ -313,8 +313,8 @@ public function makePathRelative($endPath, $startPath) { // Normalize separators on Windows if ('\\' === DIRECTORY_SEPARATOR) { - $endPath = strtr($endPath, '\\', '/'); - $startPath = strtr($startPath, '\\', '/'); + $endPath = str_replace('\\', '/', $endPath); + $startPath = str_replace('\\', '/', $startPath); } // Split the paths into arrays diff --git a/src/Symfony/Component/Finder/Iterator/ExcludeDirectoryFilterIterator.php b/src/Symfony/Component/Finder/Iterator/ExcludeDirectoryFilterIterator.php index 4ab44d156c41..66f8149446b3 100644 --- a/src/Symfony/Component/Finder/Iterator/ExcludeDirectoryFilterIterator.php +++ b/src/Symfony/Component/Finder/Iterator/ExcludeDirectoryFilterIterator.php @@ -44,7 +44,7 @@ public function __construct(\Iterator $iterator, array $directories) public function accept() { $path = $this->isDir() ? $this->current()->getRelativePathname() : $this->current()->getRelativePath(); - $path = strtr($path, '\\', '/'); + $path = str_replace('\\', '/', $path); foreach ($this->patterns as $pattern) { if (preg_match($pattern, $path)) { return false; diff --git a/src/Symfony/Component/Finder/Iterator/PathFilterIterator.php b/src/Symfony/Component/Finder/Iterator/PathFilterIterator.php index 2bb8ebd223a9..4971692c6965 100644 --- a/src/Symfony/Component/Finder/Iterator/PathFilterIterator.php +++ b/src/Symfony/Component/Finder/Iterator/PathFilterIterator.php @@ -29,7 +29,7 @@ public function accept() $filename = $this->current()->getRelativePathname(); if ('\\' === DIRECTORY_SEPARATOR) { - $filename = strtr($filename, '\\', '/'); + $filename = str_replace('\\', '/', $filename); } // should at least not match one rule to exclude