1
0
mirror of https://github.com/Ne-Lexa/php-zip.git synced 2025-08-06 23:46:28 +02:00

solving problems with lack of memory, the new ZipReader and ZipWriter class, adds .phpstorm.meta.php

#13
#16
#27
#31
#41
This commit is contained in:
Ne-Lexa
2019-12-30 18:47:37 +03:00
parent 28e220718c
commit f377b889b5
126 changed files with 12805 additions and 7819 deletions

View File

@@ -0,0 +1,47 @@
<?php
namespace PhpZip\Tests;
use PhpZip\Exception\ZipException;
use PhpZip\ZipFile;
/**
* Class ZipSlipVulnerabilityTest.
*
* @see https://github.com/Ne-Lexa/php-zip/issues/39 Issue#31
* @see https://snyk.io/research/zip-slip-vulnerability Zip Slip Vulnerability
*
* @internal
*
* @small
*/
class ZipSlipVulnerabilityTest extends ZipTestCase
{
/**
* @throws ZipException
*/
public function testCreateSlipVulnerabilityFile()
{
$localFile = '../dir/./../../file.txt';
$zipFile = new ZipFile();
$zipFile->addFromString($localFile, 'contents');
static::assertContains($localFile, $zipFile->getListFiles());
$zipFile->close();
}
/**
* @throws ZipException
*/
public function testUnpack()
{
static::assertTrue(mkdir($this->outputDirname, 0755, true));
$zipFile = new ZipFile();
$zipFile->addFromString('../dir/./../../file.txt', 'contents');
$zipFile->extractTo($this->outputDirname);
$zipFile->close();
$expectedExtractedFile = $this->outputDirname . '/dir/file.txt';
static::assertTrue(is_file($expectedExtractedFile));
}
}