1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Fix 32-bit failure of ext-zip oo_setcompression.phpt (GH-20511)

This commit is contained in:
Ilija Tovilo
2025-11-17 15:18:14 +01:00
committed by GitHub
parent 88d811708b
commit f411e7fd0f
2 changed files with 29 additions and 14 deletions

View File

@@ -34,24 +34,12 @@ try {
echo $e->getMessage(), PHP_EOL;
}
try {
$zip->setCompressionName('entry5.txt', PHP_INT_MAX);
} catch (\ValueError $e) {
echo $e->getMessage(), PHP_EOL;
}
try {
$zip->setCompressionIndex(4, PHP_INT_MIN);
} catch (\ValueError $e) {
echo $e->getMessage(), PHP_EOL;
}
try {
$zip->setCompressionIndex(4, PHP_INT_MAX);
} catch (\ValueError $e) {
echo $e->getMessage(), PHP_EOL;
}
var_dump($zip->setCompressionIndex(4, ZipArchive::CM_STORE));
var_dump($zip->setCompressionIndex(5, ZipArchive::CM_DEFLATE));
var_dump($zip->setCompressionIndex(6, ZipArchive::CM_DEFAULT));
@@ -82,8 +70,6 @@ bool(true)
bool(true)
bool(true)
ZipArchive::setCompressionName(): Argument #2 ($method) must be between -1 and %d
ZipArchive::setCompressionName(): Argument #2 ($method) must be between -1 and %d
ZipArchive::setCompressionIndex(): Argument #2 ($method) must be between -1 and %d
ZipArchive::setCompressionIndex(): Argument #2 ($method) must be between -1 and %d
bool(true)
bool(true)

View File

@@ -0,0 +1,29 @@
--TEST--
setCompressionName and setCompressionIndex methods
--EXTENSIONS--
zip
--SKIPIF--
<?php
if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
?>
--FILE--
<?php
$zip = new ZipArchive;
try {
$zip->setCompressionName('entry5.txt', PHP_INT_MAX);
} catch (\ValueError $e) {
echo $e->getMessage(), PHP_EOL;
}
try {
$zip->setCompressionIndex(4, PHP_INT_MAX);
} catch (\ValueError $e) {
echo $e->getMessage(), PHP_EOL;
}
?>
--EXPECTF--
ZipArchive::setCompressionName(): Argument #2 ($method) must be between -1 and %d
ZipArchive::setCompressionIndex(): Argument #2 ($method) must be between -1 and %d