zip: require remove_path to be shorter than the path it strips - #22973
Merged
Conversation
The zend_string conversion in bcb05dc replaced the length check with zend_string_starts_with(), which also matches on equality. A path equal to remove_path then hits the non-slash branch, strips its whole length and produces an empty archive entry name instead of keeping the path. Closes phpGH-22973
iliaal
force-pushed
the
fix/zip-remove-path-exact-match
branch
from
July 31, 2026 14:44
a8abb4f to
1538d61
Compare
Member
|
This is indeed a behavior change comparing to alpha3. Should a NEWS entry be added? |
Contributor
Author
|
Not sure if a change in alpha code qualifies, since behavior is not really "stable". |
Member
Contributor
|
If I understand correctly, this is a bug fix for bcb05dc, which didn't land in alpha3. The fix restores the old behaviour (8.4+). If my recap is correct, no NEWS entry is required. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
zend_string_starts_with()also matches on equality, so the length check dropped in bcb05dc was load-bearing. A globbed path that equals remove_path now reads its own NUL terminator in theIS_SLASHtest, falls into the non-slash branch and strips its whole length, so the entry lands in the archive under an empty name. Before the conversion the path was kept as-is, which is what 8.4 and 8.5 still do.