Commit dc4bfefdb1a for php

commit dc4bfefdb1abbad851f02b3e280ff41314a00dfb
Author: Hohphu <kodoku169@gmail.com>
Date:   Thu Nov 26 17:59:09 2026 +0800

    Fix phar_set_inode() using the zend_string header instead of the filename (#25768)

    Copy the filename bytes when computing the inode for a Phar entry.
    Copying from the zend_string header can give entries with different,
    same-length filenames the same inode number.

    Add a regression test that checks the inodes after reopening the archive
    in a separate process.

    Closes #25768

diff --git a/NEWS b/NEWS
index 5a6f4f51662..aff63aeb7db 100644
--- a/NEWS
+++ b/NEWS
@@ -166,6 +166,8 @@ PHP                                                                        NEWS
     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 --git a/ext/phar/phar_internal.h b/ext/phar/phar_internal.h
index 10e6a234edd..4ea66f7b9f8 100644
--- a/ext/phar/phar_internal.h
+++ b/ext/phar/phar_internal.h
@@ -425,7 +425,7 @@ static inline void phar_set_inode(phar_entry_info *entry) /* {{{ */
 	}

 	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);
 }
diff --git a/ext/phar/tests/phar_set_inode_collision.phpt b/ext/phar/tests/phar_set_inode_collision.phpt
new file mode 100644
index 00000000000..b3ec0ba471f
--- /dev/null
+++ b/ext/phar/tests/phar_set_inode_collision.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Phar: distinct same-length filenames in a phar archive should not collide on st_ino (phar_set_inode)
+--EXTENSIONS--
+phar
+--INI--
+phar.readonly=0
+--FILE--
+<?php
+$fname = __DIR__ . '/h13_inode_test.phar';
+@unlink($fname);
+
+$p = new Phar($fname);
+$p['aaaaa.txt'] = '1';
+$p['bbbbb.txt'] = '2';
+$p['cccccc.txt'] = '3';
+unset($p);
+
+// Verify in a clean subprocess (-n) so PHAR_G(phar_fname_map) cache is not reused
+$code = <<<'PHP'
+$f = $argv[1];
+$a = stat("phar://$f/aaaaa.txt")["ino"];
+$b = stat("phar://$f/bbbbb.txt")["ino"];
+$c = stat("phar://$f/cccccc.txt")["ino"];
+var_dump($a > 0, $a !== $b, $a !== $c, $b !== $c);
+PHP;
+
+$spec = [
+    0 => ['pipe', 'r'],
+    1 => ['pipe', 'w'],
+    2 => ['pipe', 'w'],
+];
+$proc = proc_open([PHP_BINARY, '-n', '-r', $code, '--', $fname], $spec, $pipes);
+fclose($pipes[0]);
+$stdout = stream_get_contents($pipes[1]);
+$stderr = stream_get_contents($pipes[2]);
+fclose($pipes[1]);
+fclose($pipes[2]);
+$rc = proc_close($proc);
+
+var_dump($rc === 0, $stderr === '');
+echo $stdout;
+?>
+--CLEAN--
+<?php
+@unlink(__DIR__ . '/h13_inode_test.phar');
+?>
+--EXPECT--
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+bool(true)