Skip to content

Commit

Permalink
updated php-archive lib. fixes #2361
Browse files Browse the repository at this point in the history
  • Loading branch information
splitbrain committed May 1, 2018
1 parent 10bf5c9 commit ddb94cf
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 72 deletions.
17 changes: 10 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

109 changes: 56 additions & 53 deletions vendor/composer/installed.json
Expand Up @@ -188,59 +188,6 @@
"description": "lesserphp is a compiler for LESS written in PHP based on leafo's lessphp.",
"homepage": "http://leafo.net/lessphp/"
},
{
"name": "splitbrain/php-archive",
"version": "1.0.9",
"version_normalized": "1.0.9.0",
"source": {
"type": "git",
"url": "https://github.com/splitbrain/php-archive.git",
"reference": "2a63b8cf0bfc7fdc0d987c9b7348e639e55cce76"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/splitbrain/php-archive/zipball/2a63b8cf0bfc7fdc0d987c9b7348e639e55cce76",
"reference": "2a63b8cf0bfc7fdc0d987c9b7348e639e55cce76",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "4.5.*"
},
"suggest": {
"ext-iconv": "Used for proper filename encode handling",
"ext-mbstring": "Can be used alternatively for handling filename encoding"
},
"time": "2017-06-11T06:11:38+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"splitbrain\\PHPArchive\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Andreas Gohr",
"email": "andi@splitbrain.org"
}
],
"description": "Pure-PHP implementation to read and write TAR and ZIP archives",
"keywords": [
"archive",
"extract",
"tar",
"unpack",
"unzip",
"zip"
]
},
{
"name": "paragonie/random_compat",
"version": "v2.0.12",
Expand Down Expand Up @@ -499,5 +446,61 @@
"x.509",
"x509"
]
},
{
"name": "splitbrain/php-archive",
"version": "1.0.10",
"version_normalized": "1.0.10.0",
"source": {
"type": "git",
"url": "https://github.com/splitbrain/php-archive.git",
"reference": "a46f3aaeb9f123fdb7db4e192b0600feebf7f773"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/splitbrain/php-archive/zipball/a46f3aaeb9f123fdb7db4e192b0600feebf7f773",
"reference": "a46f3aaeb9f123fdb7db4e192b0600feebf7f773",
"shasum": ""
},
"require": {
"php": ">=5.4"
},
"require-dev": {
"ext-bz2": "*",
"ext-zip": "*",
"mikey179/vfsstream": "^1.6",
"phpunit/phpunit": "^4.8"
},
"suggest": {
"ext-iconv": "Used for proper filename encode handling",
"ext-mbstring": "Can be used alternatively for handling filename encoding"
},
"time": "2018-05-01T08:03:56+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"splitbrain\\PHPArchive\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Andreas Gohr",
"email": "andi@splitbrain.org"
}
],
"description": "Pure-PHP implementation to read and write TAR and ZIP archives",
"keywords": [
"archive",
"extract",
"tar",
"unpack",
"unzip",
"zip"
]
}
]
13 changes: 11 additions & 2 deletions vendor/splitbrain/php-archive/composer.json
Expand Up @@ -11,7 +11,7 @@
"license": "MIT",

"require": {
"php": ">=5.3.0"
"php": ">=5.4"
},

"suggest": {
Expand All @@ -20,12 +20,21 @@
},

"require-dev": {
"phpunit/phpunit": "4.5.*"
"phpunit/phpunit": "^4.8",
"mikey179/vfsStream": "^1.6",
"ext-zip": "*",
"ext-bz2": "*"
},

"autoload": {
"psr-4": {
"splitbrain\\PHPArchive\\": "src"
}
},

"autoload-dev": {
"psr-4": {
"splitbrain\\PHPArchive\\": "tests"
}
}
}
7 changes: 6 additions & 1 deletion vendor/splitbrain/php-archive/phpunit.xml
Expand Up @@ -14,4 +14,9 @@
<directory suffix=".php">./tests/</directory>
</testsuite>
</testsuites>
</phpunit>
<filter>
<whitelist processUncoveredFilesFromWhitelist="false">
<directory suffix=".php">src</directory>
</whitelist>
</filter>
</phpunit>
10 changes: 5 additions & 5 deletions vendor/splitbrain/php-archive/src/Tar.php
Expand Up @@ -164,7 +164,7 @@ public function extract($outdir, $strip = '', $exclude = '', $include = '')

// extract data
if (!$fileinfo->getIsdir()) {
$fp = fopen($output, "wb");
$fp = @fopen($output, "wb");
if (!$fp) {
throw new ArchiveIOException('Could not open file for writing: '.$output);
}
Expand Down Expand Up @@ -245,7 +245,7 @@ public function addFile($file, $fileinfo = '')
throw new ArchiveIOException('Archive has been closed, files can no longer be added');
}

$fp = fopen($file, 'rb');
$fp = @fopen($file, 'rb');
if (!$fp) {
throw new ArchiveIOException('Could not open file for reading: '.$file);
}
Expand Down Expand Up @@ -379,7 +379,7 @@ public function save($file)
$this->setCompression($this->complevel, $this->filetype($file));
}

if (!file_put_contents($file, $this->getArchive())) {
if (!@file_put_contents($file, $this->getArchive())) {
throw new ArchiveIOException('Could not write to file: '.$file);
}
}
Expand Down Expand Up @@ -433,7 +433,7 @@ protected function writebytes($data)
*
* @param int $bytes seek to this position
*/
function skipbytes($bytes)
protected function skipbytes($bytes)
{
if ($this->comptype === Archive::COMPRESS_GZIP) {
@gzseek($this->fh, $bytes, SEEK_CUR);
Expand Down Expand Up @@ -645,7 +645,7 @@ public function filetype($file)
{
// for existing files, try to read the magic bytes
if(file_exists($file) && is_readable($file) && filesize($file) > 5) {
$fh = fopen($file, 'rb');
$fh = @fopen($file, 'rb');
if(!$fh) return false;
$magic = fread($fh, 5);
fclose($fh);
Expand Down
10 changes: 6 additions & 4 deletions vendor/splitbrain/php-archive/src/Zip.php
Expand Up @@ -111,7 +111,7 @@ public function contents()
* @throws ArchiveIOException
* @return FileInfo[]
*/
function extract($outdir, $strip = '', $exclude = '', $include = '')
public function extract($outdir, $strip = '', $exclude = '', $include = '')
{
if ($this->closed || !$this->file) {
throw new ArchiveIOException('Can not read from a closed archive');
Expand Down Expand Up @@ -163,7 +163,7 @@ function extract($outdir, $strip = '', $exclude = '', $include = '')
}

// open file for writing
$fp = fopen($extractto, "wb");
$fp = @fopen($extractto, "wb");
if (!$fp) {
throw new ArchiveIOException('Could not open file for writing: '.$extractto);
}
Expand Down Expand Up @@ -419,7 +419,7 @@ public function getArchive()
*/
public function save($file)
{
if (!file_put_contents($file, $this->getArchive())) {
if (!@file_put_contents($file, $this->getArchive())) {
throw new ArchiveIOException('Could not write to file: '.$file);
}
}
Expand Down Expand Up @@ -629,12 +629,14 @@ protected function header2fileinfo($header)
* similar enough. CP437 seems not to be available in mbstring. Lastly falls back to keeping the
* string as is, which is still better than nothing.
*
* On some systems iconv is available, but the codepage is not. We also check for that.
*
* @param $string
* @return string
*/
protected function cpToUtf8($string)
{
if (function_exists('iconv')) {
if (function_exists('iconv') && @iconv_strlen('', 'CP437') !== false) {
return iconv('CP437', 'UTF-8', $string);
} elseif (function_exists('mb_convert_encoding')) {
return mb_convert_encoding($string, 'UTF-8', 'CP850');
Expand Down

0 comments on commit ddb94cf

Please sign in to comment.