Commit 9c3bd917a95 for php

commit 9c3bd917a95905b7b3d1408a268afc5004ec83f8
Merge: 3a82d70397b dc4bfefdb1a
Author: Weilin Du <weilindu@php.net>
Date:   Thu Nov 26 18:00:44 2026 +0800

    Merge branch 'PHP-8.5' into PHP-8.6

    * PHP-8.5:
      Fix phar_set_inode() using the zend_string header instead of the filename (#25768)

diff --cc NEWS
index 50c3719a3cc,aff63aeb7db..732dafd8c1f
--- a/NEWS
+++ b/NEWS
@@@ -191,7 -161,13 +191,9 @@@ PH
    . Fixed bug GH-25588 (Use-after-free of a string parameter omitted on a later
      execute() or rebound while fetching). (Ilia Alshanetsky)

 -- PGSQL:
 -  . Fixed bug GH-25760 (pg_fetch_all_columns() crashes with JIT when the result
 -    for an empty set is modified). (Tomasz Kowalczyk)
 -
  - Phar:
+   . Fixed Phar file stats using the string header instead of the entry
+     filename to compute the inode number. (Hohphu)
    . Fixed bug GH-25528 (Phar::setSignatureAlgorithm(): OpenSSL signing reads a
      freed private key). (Artem Ukrainskiy)

diff --cc ext/phar/phar_internal.h
index b78a8b0176d,4ea66f7b9f8..50a423f3b0f
--- a/ext/phar/phar_internal.h
+++ b/ext/phar/phar_internal.h
@@@ -405,20 -413,21 +405,20 @@@ static inline bool phar_is_magic_phar(c

  static inline void phar_set_inode(phar_entry_info *entry) /* {{{ */
  {
 -	char tmp[MAXPATHLEN];
 -	size_t tmp_len;
 -	size_t len1, len2;
 -
 -	tmp_len = MIN(MAXPATHLEN, ZSTR_LEN(entry->filename) + entry->phar->fname_len);
 -
 -	len1 = MIN(entry->phar->fname_len, tmp_len);
  	if (entry->phar->fname) {
 -		memcpy(tmp, entry->phar->fname, len1);
 -	}
 +		char tmp[MAXPATHLEN];
 +		size_t tmp_len = MIN(MAXPATHLEN, ZSTR_LEN(entry->filename) + ZSTR_LEN(entry->phar->fname));

 -	len2 = MIN(tmp_len - len1, ZSTR_LEN(entry->filename));
 -	memcpy(tmp + len1, ZSTR_VAL(entry->filename), len2);
 +		size_t len1 = MIN(ZSTR_LEN(entry->phar->fname), tmp_len);
 +		memcpy(tmp, ZSTR_VAL(entry->phar->fname), len1);

 -	entry->inode = (unsigned short) zend_hash_func(tmp, tmp_len);
 +		size_t len2 = MIN(tmp_len - len1, ZSTR_LEN(entry->filename));
- 		memcpy(tmp + len1, entry->filename, len2);
++		memcpy(tmp + len1, ZSTR_VAL(entry->filename), len2);
 +
 +		entry->inode = (unsigned short) zend_hash_func(tmp, tmp_len);
 +	} else {
 +		entry->inode = (unsigned short) zend_string_hash_val(entry->filename);
 +	}
  }
  /* }}} */