[php-src] PR #22973: zip: require remove_path to be shorter than the path it strips
| From: | iliaal | Date: | Fri, 31 Jul 2026 14:43:42 +0000 |
| Subject: | [php-src] PR #22973: zip: require remove_path to be shorter than the path it strips | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-37414@lists.php.net to get a copy of this message | ||
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
```