From 739304bf7cad8da65bbe91c113dbd5ccb945be4a Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Thu, 13 Jun 2024 11:46:50 +0200 Subject: [PATCH] chore(deps): Bump deepdiver/zipstreamer from 2.0.2 to 2.0.3 Signed-off-by: Ferdinand Thiessen --- composer.json | 2 +- composer.lock | 23 +++++++++++++------ composer/installed.json | 23 +++++++++++++------ composer/installed.php | 12 +++++----- deepdiver/zipstreamer/src/Count64.php | 19 ++++----------- deepdiver/zipstreamer/src/Lib/Count64Base.php | 2 +- deepdiver/zipstreamer/src/Lib/Count64_32.php | 2 +- deepdiver/zipstreamer/src/Lib/Count64_64.php | 7 +++--- deepdiver/zipstreamer/src/ZipStreamer.php | 16 ++++++------- 9 files changed, 58 insertions(+), 48 deletions(-) diff --git a/composer.json b/composer.json index 24256d331..5f1ea1604 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "aws/aws-sdk-php": "^3.240", "bantu/ini-get-wrapper": "v1.0.1", "cweagans/composer-patches": "^1.7", - "deepdiver/zipstreamer": "^v2.0.2", + "deepdiver/zipstreamer": "^2.0.3", "deepdiver1975/tarstreamer": "^2.1.0", "doctrine/dbal": "^3.7.0", "egulias/email-validator": "^4.0.2", diff --git a/composer.lock b/composer.lock index 530b65a46..d90f4e4e0 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "56028816e1d278224ea6eda9aefd1b4c", + "content-hash": "4d14ded14d6eb8487843f729ca5ae46a", "packages": [ { "name": "aws/aws-crt-php", @@ -294,22 +294,25 @@ }, { "name": "deepdiver/zipstreamer", - "version": "v2.0.2", + "version": "v2.0.3", "source": { "type": "git", "url": "https://github.com/DeepDiver1975/PHPZipStreamer.git", - "reference": "f5659266771aeb3e356f75d7f39a092a291953b3" + "reference": "b9d1f53453a5736285facb723252ea2169dc472e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/DeepDiver1975/PHPZipStreamer/zipball/f5659266771aeb3e356f75d7f39a092a291953b3", - "reference": "f5659266771aeb3e356f75d7f39a092a291953b3", + "url": "https://api.github.com/repos/DeepDiver1975/PHPZipStreamer/zipball/b9d1f53453a5736285facb723252ea2169dc472e", + "reference": "b9d1f53453a5736285facb723252ea2169dc472e", "shasum": "" }, "require": { + "ext-mbstring": "*", "php": ">=7.1" }, "require-dev": { + "ext-xdebug": "*", + "ext-zlib": "*", "phpunit/phpunit": "^7 || ^8" }, "suggest": { @@ -360,9 +363,15 @@ ], "support": { "issues": "https://github.com/DeepDiver1975/PHPZipStreamer/issues", - "source": "https://github.com/DeepDiver1975/PHPZipStreamer/tree/v2.0.2" + "source": "https://github.com/DeepDiver1975/PHPZipStreamer/tree/v2.0.3" }, - "time": "2023-11-14T16:21:07+00:00" + "funding": [ + { + "url": "https://github.com/DeepDiver1975", + "type": "github" + } + ], + "time": "2024-03-13T14:30:52+00:00" }, { "name": "deepdiver1975/tarstreamer", diff --git a/composer/installed.json b/composer/installed.json index 39382dc64..bd92d8b39 100644 --- a/composer/installed.json +++ b/composer/installed.json @@ -303,29 +303,32 @@ }, { "name": "deepdiver/zipstreamer", - "version": "v2.0.2", - "version_normalized": "2.0.2.0", + "version": "v2.0.3", + "version_normalized": "2.0.3.0", "source": { "type": "git", "url": "https://github.com/DeepDiver1975/PHPZipStreamer.git", - "reference": "f5659266771aeb3e356f75d7f39a092a291953b3" + "reference": "b9d1f53453a5736285facb723252ea2169dc472e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/DeepDiver1975/PHPZipStreamer/zipball/f5659266771aeb3e356f75d7f39a092a291953b3", - "reference": "f5659266771aeb3e356f75d7f39a092a291953b3", + "url": "https://api.github.com/repos/DeepDiver1975/PHPZipStreamer/zipball/b9d1f53453a5736285facb723252ea2169dc472e", + "reference": "b9d1f53453a5736285facb723252ea2169dc472e", "shasum": "" }, "require": { + "ext-mbstring": "*", "php": ">=7.1" }, "require-dev": { + "ext-xdebug": "*", + "ext-zlib": "*", "phpunit/phpunit": "^7 || ^8" }, "suggest": { "ext-http": ">=0.10" }, - "time": "2023-11-14T16:21:07+00:00", + "time": "2024-03-13T14:30:52+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -372,8 +375,14 @@ ], "support": { "issues": "https://github.com/DeepDiver1975/PHPZipStreamer/issues", - "source": "https://github.com/DeepDiver1975/PHPZipStreamer/tree/v2.0.2" + "source": "https://github.com/DeepDiver1975/PHPZipStreamer/tree/v2.0.3" }, + "funding": [ + { + "url": "https://github.com/DeepDiver1975", + "type": "github" + } + ], "install-path": "../deepdiver/zipstreamer" }, { diff --git a/composer/installed.php b/composer/installed.php index 69528c9db..888cfa9e7 100644 --- a/composer/installed.php +++ b/composer/installed.php @@ -3,11 +3,11 @@ 'name' => 'nextcloud/3rdparty', 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => '945c283afd81531aaf4110bf0eba4add4d33bbc5', + 'reference' => 'a4e59f7913e29be2220a6be3c6b616f1ec7e8e4c', 'type' => 'library', 'install_path' => __DIR__ . '/../', 'aliases' => array(), - 'dev' => false, + 'dev' => true, ), 'versions' => array( 'aws/aws-crt-php' => array( @@ -56,9 +56,9 @@ 'dev_requirement' => false, ), 'deepdiver/zipstreamer' => array( - 'pretty_version' => 'v2.0.2', - 'version' => '2.0.2.0', - 'reference' => 'f5659266771aeb3e356f75d7f39a092a291953b3', + 'pretty_version' => 'v2.0.3', + 'version' => '2.0.3.0', + 'reference' => 'b9d1f53453a5736285facb723252ea2169dc472e', 'type' => 'library', 'install_path' => __DIR__ . '/../deepdiver/zipstreamer', 'aliases' => array(), @@ -292,7 +292,7 @@ 'nextcloud/3rdparty' => array( 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => '945c283afd81531aaf4110bf0eba4add4d33bbc5', + 'reference' => 'a4e59f7913e29be2220a6be3c6b616f1ec7e8e4c', 'type' => 'library', 'install_path' => __DIR__ . '/../', 'aliases' => array(), diff --git a/deepdiver/zipstreamer/src/Count64.php b/deepdiver/zipstreamer/src/Count64.php index ab58bbe8e..1101f0d57 100644 --- a/deepdiver/zipstreamer/src/Count64.php +++ b/deepdiver/zipstreamer/src/Count64.php @@ -22,8 +22,9 @@ */ namespace ZipStreamer; -use \ZipStreamer\Lib\Count64_32; -use \ZipStreamer\Lib\Count64_64; +use ZipStreamer\Lib\Count64_32; +use ZipStreamer\Lib\Count64_64; +use ZipStreamer\Lib\Count64Base; const INT64_HIGH_MAP = 0xffffffff00000000; const INT64_LOW_MAP = 0x00000000ffffffff; @@ -43,16 +44,6 @@ function urShift($bits, $shift) { return ($bits >> $shift) & ~(1 << (8 * PHP_INT_SIZE - 1) >> ($shift - 1)); } -/** - * Convert binary data string to readable hex string - * - * @param string $data binary string - * @return string readable hex string - */ -function byte2hex($data) { - return unpack("h*", $data); -} - /** * Pack 1 byte data into binary string * @@ -149,8 +140,8 @@ abstract class Count64 { public static function construct($value = 0, $limit32Bit = False) { if (4 == PHP_INT_SIZE) { return new Count64_32($value, $limit32Bit); - } else { - return new Count64_64($value, $limit32Bit); } + + return new Count64_64($value, $limit32Bit); } } diff --git a/deepdiver/zipstreamer/src/Lib/Count64Base.php b/deepdiver/zipstreamer/src/Lib/Count64Base.php index 7ae5dcd69..a97a047fa 100644 --- a/deepdiver/zipstreamer/src/Lib/Count64Base.php +++ b/deepdiver/zipstreamer/src/Lib/Count64Base.php @@ -25,7 +25,7 @@ abstract class Count64Base { protected $limit32Bit = False; - function __construct($value = 0, $limit32Bit = False) { + public function __construct($value = 0, $limit32Bit = False) { $this->limit32Bit = $limit32Bit; $this->set($value); } diff --git a/deepdiver/zipstreamer/src/Lib/Count64_32.php b/deepdiver/zipstreamer/src/Lib/Count64_32.php index e8c7ceb85..800577443 100644 --- a/deepdiver/zipstreamer/src/Lib/Count64_32.php +++ b/deepdiver/zipstreamer/src/Lib/Count64_32.php @@ -42,7 +42,7 @@ public function set($value) { if (is_int($value)) { $this->loBytes = $value; $this->hiBytes = 0; - } else if (is_array($value) && 2 == sizeof($value)) { + } else if (is_array($value) && 2 == count($value)) { $this->loBytes = $value[0]; if ($this->limit32Bit && 0 !== $value[1]) { throw new \OverflowException(self::EXCEPTION_32BIT_OVERFLOW); diff --git a/deepdiver/zipstreamer/src/Lib/Count64_64.php b/deepdiver/zipstreamer/src/Lib/Count64_64.php index 1a31741ca..e27021a26 100644 --- a/deepdiver/zipstreamer/src/Lib/Count64_64.php +++ b/deepdiver/zipstreamer/src/Lib/Count64_64.php @@ -22,8 +22,9 @@ */ namespace ZipStreamer\Lib; -use const \ZipStreamer\INT64_LOW_MAP; -use const \ZipStreamer\INT_MAX_32; +use function ZipStreamer\urShift; +use const ZipStreamer\INT64_LOW_MAP; +use const ZipStreamer\INT_MAX_32; class Count64_64 extends Count64Base { private $value; @@ -46,7 +47,7 @@ public function set($value) { throw new \OverFlowException(self::EXCEPTION_32BIT_OVERFLOW); } $this->value = $value; - } else if (is_array($value) && 2 == sizeof($value)) { + } else if (is_array($value) && 2 == count($value)) { if ($this->limit32Bit && 0 !== $value[1]) { throw new \OverFlowException(self::EXCEPTION_32BIT_OVERFLOW); } diff --git a/deepdiver/zipstreamer/src/ZipStreamer.php b/deepdiver/zipstreamer/src/ZipStreamer.php index 6cd1a9710..e476eb62e 100644 --- a/deepdiver/zipstreamer/src/ZipStreamer.php +++ b/deepdiver/zipstreamer/src/ZipStreamer.php @@ -48,7 +48,7 @@ class ZipStreamer { private $extFileAttrFile; private $extFileAttrDir; - /** @var stream output stream zip file is written to */ + /** @var resource $outStream output stream zip file is written to */ private $outStream; /** @var boolean zip64 enabled */ private $zip64 = True; @@ -356,7 +356,7 @@ private function streamFileData($stream, $compress, $level) { $compStream = DeflateStream::create($level); } - while (!feof($stream) && $data = fread($stream, self::STREAM_CHUNK_SIZE)) { + while (!feof($stream) && ($data = fread($stream, self::STREAM_CHUNK_SIZE)) !== false) { $dataLength->add(strlen($data)); hash_update($hashCtx, $data); if (COMPR::DEFLATE === $compress) { @@ -438,7 +438,7 @@ private function addDataDescriptor($dataLength, $gzLength, $dataCRC32) { private function buildZip64EndOfCentralDirectoryRecord($cdRecLength) { $versionToExtract = $this->getVersionToExtract(False); - $cdRecCount = sizeof($this->cdRec); + $cdRecCount = count($this->cdRec); return '' . pack32le(self::ZIP64_END_OF_CENTRAL_DIRECTORY) // zip64 end of central dir signature 4 bytes (0x06064b50) @@ -517,12 +517,12 @@ private function buildCentralDirectoryHeader($filePath, $timestamp, $gpFlags, private function buildEndOfCentralDirectoryRecord($cdRecLength) { if ($this->zip64) { $diskNumber = -1; - $cdRecCount = min(sizeof($this->cdRec), 0xffff); + $cdRecCount = min(count($this->cdRec), 0xffff); $cdRecLength = -1; $offset = -1; } else { $diskNumber = 0; - $cdRecCount = sizeof($this->cdRec); + $cdRecCount = count($this->cdRec); $offset = $this->offset->getLoBytes(); } //throw new \Exception(sprintf("zip64 %d diskno %d", $this->zip64, $diskNumber)); @@ -646,7 +646,7 @@ protected function __construct($level) { $class = self::PECL2_DEFLATE_STREAM_CLASS; } if (!class_exists($class)) { - new \Exception('unable to instantiate PECL deflate stream (requires pecl_http >= 0.10)'); + throw new \Exception('unable to instantiate PECL deflate stream (requires pecl_http >= 0.10)'); } $deflateFlags = constant($class . '::TYPE_RAW'); @@ -723,8 +723,8 @@ class GPFLAGS { // compression settings for deflate/deflate64 const DEFL_NORM = 0x0000; // normal compression (COMP1 and COMP2 not set) - const DEFL_MAX = COMP1; // maximum compression - const DEFL_FAST = COMP2; // fast compression + const DEFL_MAX = self::COMP1; // maximum compression + const DEFL_FAST = self::COMP2; // fast compression const DEFL_SFAST = 0x0006; // superfast compression (COMP1 and COMP2 set) }