Repository navigation
Conversation
Since entry->filename was converted to zend_string* in PHP 8.5, phar_set_inode() copied from the zend_string struct
header instead of ZSTR_VAL(entry->filename), causing distinct same-length filenames (<= 24 bytes) to collide on st_ino.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
ndossche
approved these changes
Nov 26, 2026
LamentXU123
added a commit
that referenced
this pull request
Nov 26, 2026
* PHP-8.6: Fix phar_set_inode() using the zend_string header instead of the filename (#25768)
realFlowControl
pushed a commit
to realFlowControl/php-src
that referenced
this pull request
Nov 26, 2026
* PHP-8.5: Fix phar_set_inode() using the zend_string header instead of the filename (php#25768)
arnaud-lb
added a commit
to hohphu8/php-src
that referenced
this pull request
Nov 26, 2026
* PHP-8.6: Fix stale string metadata in sodium_add() and sodium_increment() (php#25775) Sync `session.upload_progress.enabled` default in `php.ini-{development,production}` (php#25743) ext/pgsql: fix pg_fetch_object() JIT crash when constructor keeps $this Fix hash() and hash_file() hanging on invalid xxh3/xxh128 options (php#25777) Fix phar_set_inode() using the zend_string header instead of the filename (php#25768) Fix phpGH-25360: ZipArchive assertion when error handler throws at shutdown (php#25361)
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.
phar_set_inode()inext/phar/phar_internal.hpassesentry->filenametomemcpy(). Sincephar_entry_info.filenameis azend_string *in PHP 8.5, this copies from the start of thezend_stringstruct (header) rather than from the filename characters:As a result the inode is not derived from the actual filename, and entries with same-length names can end up with the same
st_ino. The fix is to copy fromZSTR_VAL(entry->filename).Adds a regression test (
ext/phar/tests/phar_set_inode_collision.phpt) that checks distinct entries get distinct inodes. It fails before the fix and passes after. I ran it on PHP-8.5 NTS debug and ZTS builds, and the fullext/phar/tests/passes.Targeting PHP-8.5 because
filenameis still achar *in PHP-8.4 (not affected).Note: I found this through source inspection with an automated/LLM-assisted tool, then reproduced and verified it myself.