Skip to content
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

Use zend_string for phar alias #17511

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

nielsdos
Copy link
Member

No description provided.

Copy link
Member

@Girgias Girgias left a 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.

ext/phar/phar.c Show resolved Hide resolved
ext/phar/phar.c Outdated Show resolved Hide resolved
Comment on lines +2680 to +2681
// 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)*/) {
Copy link
Member

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...

Copy link
Member Author

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.

Copy link
Member

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 ?

ext/phar/phar_object.c Outdated Show resolved Hide resolved
ext/phar/util.c Outdated Show resolved Hide resolved
ext/phar/zip.c Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants