-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Use zend_string for phar alias #17511
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
base: master
Are you sure you want to change the base?
Conversation
e088c3b
to
0379bbd
Compare
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.
Initial review, the hash_del stuff can be another PR.
// TODO: what was the point of the fname != alias check? Adding a check for the byte contents make some cache_list tests fail... | ||
if (phar_obj->archive->alias/* && !zend_string_equals_cstr(phar_obj->archive->alias, phar_obj->archive->fname, phar_obj->archive->fname_len)*/) { |
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.
Lovely, this feels like it supposed the alias shared the pointer with an fname, which seems weird. But surely if the alias is equal to the filename then it is not really an alias...
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.
Yeah it's almost as if the check is actually checking whether the alias was ever changed manually, but I'm not sure and this code has been here since the beginning. In classic PHP fashion the alias functionality is also underspecified and the impact of the branch is not tested.
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.
You wouldn't know the behaviour of this by any chance @theofidry ?
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.
Apologies only saw that now.
This seems really obscure and confusing to me. So I do not have any clue unfortunately.
it's almost as if the check is actually checking whether the alias was ever changed manually
I fail to understand (I don't really understand this piece of C code) why it is of any relevance, but in case this is not known (doubt it, but better safe than sorry), the alias can indeed be changed at any time, including after the Phar
object was built.
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 fail to understand (I don't really understand this piece of C code) why it is of any relevance, but in case this is not known (doubt it, but better safe than sorry), the alias can indeed be changed at any time, including after the Phar object was built.
Thanks for the input
Yes indeed. This is why the check is so strange.
I'd opt to just drop the check, it doesn't make sense and no test is influenced. If it breaks anyway, CI nightly or early adopters might catch it (and we still have like half a year to catch this).
No description provided.