[GIT-PULLS] [php-src] PR #22973: zip: require remove_path to be shorter than the path it strips
[email protected] (iliaal) Fri, 31 Jul 2026 14:43:42 +0000
| Newsgroups | php.git-pulls |
|---|---|
| Message-ID | <[email protected]> |
Pull Request: https://github.com/php/php-src/pull/22973
Author: iliaal
`zend_string_starts_with()` also matches on equality, so the length check dropped in bcb05dcf6f3 was load-bearing. A globbed path that equals remove_path now reads its own NUL terminator in the `IS_SLASH` test, 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.
```php
$zip->addGlob("$dir/*.txt", 0, ['remove_path' => "$dir/a.txt"]);
// a.txt is added as "", b.txt keeps its full path
```