1
0
mirror of https://github.com/Ne-Lexa/php-zip.git synced 2025-07-31 12:40:09 +02:00

fixed for php 32-bit

This commit is contained in:
Ne-Lexa
2019-12-06 12:09:37 +03:00
parent e03c963dc1
commit e2c058840c
21 changed files with 117 additions and 154 deletions

View File

@@ -9,7 +9,6 @@ use PhpZip\Util\CryptoUtil;
* @internal
*
* @small
* @covers
*/
class Issue24Test extends ZipTestCase
{

View File

@@ -3,6 +3,7 @@
namespace PhpZip;
use PhpZip\Exception\Crc32Exception;
use PhpZip\Exception\RuntimeException;
use PhpZip\Exception\ZipAuthenticationException;
use PhpZip\Exception\ZipException;
@@ -12,7 +13,6 @@ use PhpZip\Exception\ZipException;
* @internal
*
* @small
* @covers
*/
class PhpZipExtResourceTest extends ZipTestCase
{
@@ -126,7 +126,14 @@ class PhpZipExtResourceTest extends ZipTestCase
*/
public function testBug70752()
{
$this->setExpectedException(ZipAuthenticationException::class, 'nvalid password for zip entry "bug70752.txt"');
if (\PHP_INT_SIZE === 4) { // php 32 bit
$this->setExpectedException(RuntimeException::class, 'Traditional PKWARE Encryption is not supported in 32-bit PHP.');
} else { // php 64 bit
$this->setExpectedException(
ZipAuthenticationException::class,
'nvalid password for zip entry "bug70752.txt"'
);
}
$filename = __DIR__ . '/php-zip-ext-test-resources/bug70752.zip';

View File

@@ -8,7 +8,6 @@ use PhpZip\Exception\ZipException;
* @internal
*
* @large
* @covers
*/
class Zip64Test extends ZipTestCase
{

View File

@@ -11,7 +11,6 @@ use PhpZip\Util\CryptoUtil;
* @internal
*
* @small
* @covers
*/
class ZipAlignTest extends ZipTestCase
{

View File

@@ -8,7 +8,6 @@ use PhpZip\Exception\ZipException;
* @internal
*
* @small
* @covers
*/
class ZipEventTest extends ZipTestCase
{

View File

@@ -12,7 +12,6 @@ use PhpZip\Util\Iterator\IgnoreFilesRecursiveFilterIterator;
* @internal
*
* @small
* @covers
*/
class ZipFileAddDirTest extends ZipTestCase
{

View File

@@ -19,7 +19,6 @@ use Zend\Diactoros\Response;
* @internal
*
* @small
* @covers
*/
class ZipFileTest extends ZipTestCase
{
@@ -44,6 +43,8 @@ class ZipFileTest extends ZipTestCase
/** @noinspection PhpComposerExtensionStubsInspection */
if (posix_getuid() === 0) {
static::markTestSkipped('Skip the test for a user with root privileges');
return;
}
static::assertNotFalse(file_put_contents($this->outputFilename, 'content'));
@@ -170,6 +171,8 @@ class ZipFileTest extends ZipTestCase
if (!\extension_loaded('gd')) {
static::markTestSkipped('not extension gd');
return;
}
/** @noinspection PhpComposerExtensionStubsInspection */
$zipFile->openFromStream(imagecreate(1, 1));
@@ -425,6 +428,8 @@ class ZipFileTest extends ZipTestCase
{
if (!\function_exists('mime_content_type')) {
static::markTestSkipped('Function mime_content_type not exists');
return;
}
$outputFilename = $this->outputFilename;
$this->outputFilename .= '.gif';
@@ -1117,6 +1122,8 @@ class ZipFileTest extends ZipTestCase
/** @noinspection PhpComposerExtensionStubsInspection */
if (posix_getuid() === 0) {
static::markTestSkipped('Skip the test for a user with root privileges');
return;
}
$zipFile = new ZipFile();
@@ -1341,6 +1348,8 @@ class ZipFileTest extends ZipTestCase
/** @noinspection PhpComposerExtensionStubsInspection */
if (posix_getuid() === 0) {
static::markTestSkipped('Skip the test for a user with root privileges');
return;
}
static::assertNotFalse(file_put_contents($this->outputFilename, ''));
@@ -1658,6 +1667,8 @@ class ZipFileTest extends ZipTestCase
/** @noinspection PhpComposerExtensionStubsInspection */
if (posix_getuid() === 0) {
static::markTestSkipped('Skip the test for a user with root privileges');
return;
}
static::assertTrue(mkdir($this->outputDirname, 0444, true));

View File

@@ -11,7 +11,6 @@ use PhpZip\Util\CryptoUtil;
* @internal
*
* @small
* @covers
*/
class ZipMatcherTest extends TestCase
{

View File

@@ -2,6 +2,7 @@
namespace PhpZip;
use PhpZip\Exception\RuntimeException;
use PhpZip\Exception\ZipAuthenticationException;
use PhpZip\Exception\ZipEntryNotFoundException;
use PhpZip\Exception\ZipException;
@@ -14,7 +15,6 @@ use PhpZip\Util\CryptoUtil;
* @internal
*
* @small
* @covers
*/
class ZipPasswordTest extends ZipFileAddDirTest
{
@@ -25,8 +25,8 @@ class ZipPasswordTest extends ZipFileAddDirTest
*/
public function testSetPassword()
{
if (\PHP_INT_SIZE === 4) {
static::markTestSkipped('Skip test for 32-bit system. Not support Traditional PKWARE Encryption.');
if (\PHP_INT_SIZE === 4) { // php 32 bit
$this->setExpectedException(RuntimeException::class, 'Traditional PKWARE Encryption is not supported in 32-bit PHP.');
}
$password = base64_encode(CryptoUtil::randomBytes(100));
@@ -120,8 +120,8 @@ class ZipPasswordTest extends ZipFileAddDirTest
*/
public function testTraditionalEncryption()
{
if (\PHP_INT_SIZE === 4) {
static::markTestSkipped('Skip test for 32-bit system. Not support Traditional PKWARE Encryption.');
if (\PHP_INT_SIZE === 4) { // php 32 bit
$this->setExpectedException(RuntimeException::class, 'Traditional PKWARE Encryption is not supported in 32-bit PHP.');
}
$password = base64_encode(CryptoUtil::randomBytes(50));
@@ -200,8 +200,8 @@ class ZipPasswordTest extends ZipFileAddDirTest
*/
public function testEncryptionEntries()
{
if (\PHP_INT_SIZE === 4) {
static::markTestSkipped('Skip test for 32-bit system. Not support Traditional PKWARE Encryption.');
if (\PHP_INT_SIZE === 4) { // php 32 bit
$this->setExpectedException(RuntimeException::class, 'Traditional PKWARE Encryption is not supported in 32-bit PHP.');
}
$password1 = '353442434235424234';
@@ -247,8 +247,8 @@ class ZipPasswordTest extends ZipFileAddDirTest
*/
public function testEncryptionEntriesWithDefaultPassword()
{
if (\PHP_INT_SIZE === 4) {
static::markTestSkipped('Skip test for 32-bit system. Not support Traditional PKWARE Encryption.');
if (\PHP_INT_SIZE === 4) { // php 32 bit
$this->setExpectedException(RuntimeException::class, 'Traditional PKWARE Encryption is not supported in 32-bit PHP.');
}
$password1 = '353442434235424234';

View File

@@ -10,7 +10,6 @@ use PhpZip\Exception\ZipException;
* @internal
*
* @small
* @covers
*/
class ZipRemoteFileTest extends ZipTestCase
{

View File

@@ -11,7 +11,6 @@ namespace PhpZip;
* @internal
*
* @small
* @covers
*/
class ZipSlipVulnerabilityTest extends ZipTestCase
{