Fix GH-21705: ZipArchive::getFromIndex() ignores ZipArchive::FL_UNCHANGED for deleted entries#21706
Fix GH-21705: ZipArchive::getFromIndex() ignores ZipArchive::FL_UNCHANGED for deleted entries#21706LamentXU123 wants to merge 4 commits intophp:masterfrom
Conversation
|
One pre-existing concern worth flagging while we're touching this line: the I ran this on master + this patch: $zip->getFromName('bar.txt', 0, -1); // receives 0xFFFFFFFF (all libzip flags set)
$zip->getFromName('foo.txt', 0, PHP_INT_MAX); // receives lower 32 bits silently
$zip->getFromName('bar.txt', 0, 0x100000000); // truncates to 0, FL_UNCHANGED intent lost silentlyThe third case is the worst: the caller's flag intent lives in the upper 32 bits, truncates to zero on the way into libzip, and they get The same pattern shows up on all 15 |
fixes #21705 by passing the correct flag into
PHP_ZIP_STAT_INDEXThe code is as follows:
when mode == 1 its for getFromName, where it calls
PHP_ZIP_STAT_PATHwith the correct argumentsflagswhen mode == 0 its for getFromIndex, where it calls
PHP_ZIP_STAT_INDEXwith flag be forced to 0It's quite bizarre.