Open
Description
Symfony version(s) affected
7.3.0 (symfony/filesystem)
Description
Symfony\Component\Filesystem\Path::normalize
replaces \
with /
. That is valid on Windows, but not on Unix-like systems, because \
is a valid path character there and not a path separator.
How to reproduce
Simply call Symfony\Component\Filesystem\Path::normalize('foo\\bar')
and it outputs foo/bar
instead of foo\bar
. Or check the following code line. It is pretty self-explanatory: https://github.com/symfony/filesystem/blob/b8dce482de9d7c9fe2891155035a7248ab5c7fdb/Path.php#L116.
Possible Solution
Change Symfony\Component\Filesystem\Path::normalize
to:
public static function normalize(string $path): string
{
return DIRECTORY_SEPARATOR === '/' ? $path : str_replace('\\', '/', $path);
}
Additional Context
No response