-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix 8861 properly #8869
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
Fix 8861 properly #8869
Conversation
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.
LGTM by what I can tell. 👍
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.
Knowing nothing about SplFileInfo
, does this account for Windows paths?
@@ -651,14 +651,17 @@ static inline HashTable *spl_filesystem_object_get_debug_info(zend_object *objec | |||
pnstr = spl_gen_private_prop_name(spl_ce_SplFileInfo, "fileName", sizeof("fileName")-1); | |||
path = spl_filesystem_object_get_path(intern); | |||
|
|||
if (ZSTR_LEN(path) && ZSTR_LEN(path) < ZSTR_LEN(intern->file_name)) { | |||
if (path && ZSTR_LEN(path) && ZSTR_LEN(path) < ZSTR_LEN(intern->file_name)) { | |||
/* +1 to skip the trailing / of the path in the file name */ |
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.
Wouldn't that be a leading slash?
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.
Not sure if this behaves differently on a windows machine, but \SplFileInfo
IMHO always only worked properly with forward slashes. See https://3v4l.org/lsPaS.
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.
Wouldn't that be a leading slash?
Huuum maybe it's wording, I used trailing as in 'foo/bar.baz'
the path is foo
so we need to skip the slash just after foo
therefore trailing the path?
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.
Not sure if this behaves differently on a windows machine, but
\SplFileInfo
IMHO always only worked properly with forward slashes. See https://3v4l.org/lsPaS.
Great, more reasons for me to hate SPL :|
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.
Nope, that works as expected on Windows (3v4l.org runs Linux).
Apparently, when executed on windows, both separators work |
This should be true for all file related operations in the PHP core. |
The behavior on windows (and the discussion whether its correct or not) should probably be handled in a different PR/RFC. I'd vote for merging this PR as is. 👍 |
This is not possible the name |
My comment was just generally speaking. I meant: all file related PHP operations are agnostic towards the usage of a forward or backward slash as a directory separator under Windows, including things like |
I don't know how to GitHub and push to the fork branch so ... new PR.
@m-vo Have a look if this does the job