[php-src] master: Merge branch 'PHP-8.6'

From: Date: Thu, 26 Nov 2026 10:02:58 +0000
Subject: [php-src] master: Merge branch 'PHP-8.6'
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-144208@lists.php.net to get a copy of this message
Author: Weilin Du (LamentXU123) Date: 2026-11-26T18:01:14+08:00 Commit: https://github.com/php/php-src/commit/339acac74fc3f2b4ea7ba1b3b2b2d8eef679b185 Raw diff: https://github.com/php/php-src/commit/339acac74fc3f2b4ea7ba1b3b2b2d8eef679b185.diff Merge branch 'PHP-8.6' * PHP-8.6: Fix phar_set_inode() using the zend_string header instead of the filename (#25768) Changed paths: A ext/phar/tests/phar_set_inode_collision.phpt M ext/phar/phar_internal.h Diff: diff --git a/ext/phar/phar_internal.h b/ext/phar/phar_internal.h index b78a8b0176dc..50a423f3b0fa 100644 --- a/ext/phar/phar_internal.h +++ b/ext/phar/phar_internal.h @@ -413,7 +413,7 @@ static inline void phar_set_inode(phar_entry_info *entry) /* {{{ */ memcpy(tmp, ZSTR_VAL(entry->phar->fname), len1); 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 { 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 000000000000..b3ec0ba471f9 --- /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)

« previous php.cvs (#144208) next »