upgraded php-archive to 1.2.0 #3298

fixes an incompatibility with PHP 8
This commit is contained in:
Andreas Gohr 2020-10-13 15:07:33 +02:00
parent 8368419bb5
commit a3bfbb3c10
7 changed files with 35 additions and 17 deletions

10
composer.lock generated
View File

@ -414,16 +414,16 @@
},
{
"name": "splitbrain/php-archive",
"version": "1.1.1",
"version": "1.2.0",
"source": {
"type": "git",
"url": "https://github.com/splitbrain/php-archive.git",
"reference": "10d89013572ba1f4d4ad7fcb74860242f4c3860b"
"reference": "d4cf2d9a2d82548b7e4f1dc04802c526eba68b65"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/splitbrain/php-archive/zipball/10d89013572ba1f4d4ad7fcb74860242f4c3860b",
"reference": "10d89013572ba1f4d4ad7fcb74860242f4c3860b",
"url": "https://api.github.com/repos/splitbrain/php-archive/zipball/d4cf2d9a2d82548b7e4f1dc04802c526eba68b65",
"reference": "d4cf2d9a2d82548b7e4f1dc04802c526eba68b65",
"shasum": ""
},
"require": {
@ -464,7 +464,7 @@
"unzip",
"zip"
],
"time": "2018-09-09T12:13:53+00:00"
"time": "2020-10-13T12:41:15+00:00"
},
{
"name": "splitbrain/php-cli",

View File

@ -60,7 +60,7 @@ class ClassLoader
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
return call_user_func_array('array_merge', $this->prefixesPsr0);
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
}
return array();

View File

@ -421,17 +421,17 @@
},
{
"name": "splitbrain/php-archive",
"version": "1.1.1",
"version_normalized": "1.1.1.0",
"version": "1.2.0",
"version_normalized": "1.2.0.0",
"source": {
"type": "git",
"url": "https://github.com/splitbrain/php-archive.git",
"reference": "10d89013572ba1f4d4ad7fcb74860242f4c3860b"
"reference": "d4cf2d9a2d82548b7e4f1dc04802c526eba68b65"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/splitbrain/php-archive/zipball/10d89013572ba1f4d4ad7fcb74860242f4c3860b",
"reference": "10d89013572ba1f4d4ad7fcb74860242f4c3860b",
"url": "https://api.github.com/repos/splitbrain/php-archive/zipball/d4cf2d9a2d82548b7e4f1dc04802c526eba68b65",
"reference": "d4cf2d9a2d82548b7e4f1dc04802c526eba68b65",
"shasum": ""
},
"require": {
@ -447,7 +447,7 @@
"ext-iconv": "Used for proper filename encode handling",
"ext-mbstring": "Can be used alternatively for handling filename encoding"
},
"time": "2018-09-09T12:13:53+00:00",
"time": "2020-10-13T12:41:15+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {

View File

@ -21,7 +21,7 @@
"require-dev": {
"phpunit/phpunit": "^4.8",
"mikey179/vfsStream": "^1.6",
"mikey179/vfsstream": "^1.6",
"ext-zip": "*",
"ext-bz2": "*"
},

View File

@ -37,6 +37,24 @@ class FileInfo
$this->setPath($path);
}
/**
* Handle calls to deprecated methods
*
* @param string $name
* @param array $arguments
* @return mixed
*/
public function __call($name, $arguments)
{
if($name === 'match') {
trigger_error('FileInfo::match() is deprecated, use FileInfo::matchExpression() instead.', E_USER_NOTICE);
return call_user_func_array([$this, $name], $arguments);
}
trigger_error('Call to undefined method FileInfo::'.$name.'()', E_USER_ERROR);
return null;
}
/**
* Factory to build FileInfo from existing file or directory
*
@ -324,7 +342,7 @@ class FileInfo
* @param string $exclude Regular expression of files to exclude
* @return bool
*/
public function match($include = '', $exclude = '')
public function matchExpression($include = '', $exclude = '')
{
$extract = true;
if ($include && !preg_match($include, $this->getPath())) {

View File

@ -158,7 +158,7 @@ class Tar extends Archive
$fileinfo->strip($strip);
// skip unwanted files
if (!strlen($fileinfo->getPath()) || !$fileinfo->match($include, $exclude)) {
if (!strlen($fileinfo->getPath()) || !$fileinfo->matchExpression($include, $exclude)) {
$this->skipbytes(ceil($header['size'] / 512) * 512);
continue;
}
@ -583,7 +583,7 @@ class Tar extends Archive
$return['checksum'] = OctDec(trim($header['checksum']));
if ($return['checksum'] != $chks) {
throw new ArchiveCorruptedException('Header does not match it\'s checksum');
throw new ArchiveCorruptedException('Header does not match its checksum');
}
$return['filename'] = trim($header['filename']);

View File

@ -142,7 +142,7 @@ class Zip extends Archive
$fileinfo->strip($strip);
// skip unwanted files
if (!strlen($fileinfo->getPath()) || !$fileinfo->match($include, $exclude)) {
if (!strlen($fileinfo->getPath()) || !$fileinfo->matchExpression($include, $exclude)) {
continue;
}