-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Filesystem] Fixed makePathRelative #22321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
fc745f4
3a29c1d
15982d4
9586e88
cec473e
1b795d7
fea3bb0
28b29ee
193cdf8
bce33c4
23b4a56
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -847,6 +847,7 @@ public function providePathsForMakePathRelative() | |||
array('/var/lib/symfony/src/Symfony', '/var/lib/symfony/src/Symfony/Component/', '../'), | ||||
array('var/lib/symfony/', 'var/lib/symfony/src/Symfony/Component', '../../../'), | ||||
array('/usr/lib/symfony/', '/var/lib/symfony/src/Symfony/Component', '../../../../../../usr/lib/symfony/'), | ||||
array('usr/lib/symfony/', 'var/lib/symfony/src/Symfony/Component', '../../../../../../usr/lib/symfony/'), | ||||
array('/var/lib/symfony/src/Symfony/', '/var/lib/symfony/', 'src/Symfony/'), | ||||
array('/aa/bb', '/aa/bb', './'), | ||||
array('/aa/bb', '/aa/bb/', './'), | ||||
|
@@ -878,6 +879,8 @@ public function providePathsForMakePathRelative() | |||
array('C:/aa/bb/../../cc', 'C:/aa/../dd/..', 'cc/'), | ||||
array('C:/../aa/bb/cc', 'C:/aa/dd/..', 'bb/cc/'), | ||||
array('C:/../../aa/../bb/cc', 'C:/aa/dd/..', '../bb/cc/'), | ||||
array('aa/bb', 'aa/cc', '../bb/'), | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not something that is supported. The docblock states that the paths have to be absolute. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was already an existing unit test (FilesystemTest.php:1097) that tested relative paths. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's not add new ones. Tests should respect the contract which is to pass an absolute path. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @chalasr the function always supported relative paths (before 3.2.7). There are even pre-existing test cases for that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@chalasr Should I remove the pre-existing relative path tests then too? Or should I just remove the relative path tests that I added? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please provide a new link to this test? Previous one is outdated and I can't find it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it’s line 1102 in the current master branch:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed, it should be removed (we did revert a similar test for the very same reason #22133 (comment)). It's safe to do it here I think. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in a2a1d0d There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @chalasr Actually, the example that you gave was a test I mistakenly added in that very same PR. So it was never part of a merge. :) |
||||
array('aa/cc', 'bb/cc', '../../aa/cc/'), | ||||
); | ||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR) { | ||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of
substr()
I suggest to use':' === $path[1] && '/' === $path[2]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used
substr()
because it’s done that way inisAbsolutePath()
Filesystem.php:587. Should I change it though?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I change the
substr()
to':' === $path[1] && '/' === $path[2]
to get this pull request approved?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 for @xabbuh's suggestion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in bce33c4