Closed
Description
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
BC Break report? | no |
RFC? | no |
Symfony version | master |
Looking at the code of Filesystem::makePathRelative method I have found several issues:
- Stripping of drive letter for arguments is done regardless of host OS but directory separator normalization is done only for Windows hosts.
- There is no drive check for Windows paths, hence for the following case result will be invalid:
(new Filesystem())->makePathRelative('C:/aa/bb/cc', 'D:/aa/dd/..')
produces'bb/cc/'
(new Filesystem())->makePathRelative('/aa/bb/cc', '/aa')
produces'bb/cc/'
which is wrong since'/aa/bb/cc'
can be the file path, the presence of trailing slash in the result should be based on presence of trailing slash in the$endPath
argument.