Skip to content

Commit

Permalink
Merge pull request #1865 from nextcloud/backport/1863/stable28
Browse files Browse the repository at this point in the history
[stable28] chore(deps): Bump deepdiver/zipstreamer from 2.0.2 to 2.0.3
  • Loading branch information
susnux authored Jun 25, 2024
2 parents 4257896 + 4ca5357 commit 1ce7a1b
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 60 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"aws/aws-sdk-php": "^3.240",
"bantu/ini-get-wrapper": "v1.0.1",
"cweagans/composer-patches": "^1.7",
"deepdiver/zipstreamer": "2.0.0",
"deepdiver/zipstreamer": "^2.0.3",
"deepdiver1975/tarstreamer": "^2.1.0",
"doctrine/dbal": "^3.7.0",
"egulias/email-validator": "^3.2.5",
Expand Down
32 changes: 22 additions & 10 deletions composer.lock

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

32 changes: 22 additions & 10 deletions composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -365,26 +365,32 @@
},
{
"name": "deepdiver/zipstreamer",
"version": "2.0.0",
"version_normalized": "2.0.0.0",
"version": "v2.0.3",
"version_normalized": "2.0.3.0",
"source": {
"type": "git",
"url": "https://github.com/DeepDiver1975/PHPZipStreamer.git",
"reference": "b8c59647ff34fb97e8937aefb2a65de2bc4b4755"
"reference": "b9d1f53453a5736285facb723252ea2169dc472e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/DeepDiver1975/PHPZipStreamer/zipball/b8c59647ff34fb97e8937aefb2a65de2bc4b4755",
"reference": "b8c59647ff34fb97e8937aefb2a65de2bc4b4755",
"url": "https://api.github.com/repos/DeepDiver1975/PHPZipStreamer/zipball/b9d1f53453a5736285facb723252ea2169dc472e",
"reference": "b9d1f53453a5736285facb723252ea2169dc472e",
"shasum": ""
},
"require": {
"php": ">=5.6.0"
"ext-mbstring": "*",
"php": ">=7.1"
},
"require-dev": {
"phpunit/phpunit": "^5.7"
"ext-xdebug": "*",
"ext-zlib": "*",
"phpunit/phpunit": "^7 || ^8"
},
"suggest": {
"ext-http": ">=0.10"
},
"time": "2020-07-21T07:45:14+00:00",
"time": "2024-03-13T14:30:52+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
Expand All @@ -394,7 +400,7 @@
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"GPL-3.0+"
"GPL-3.0-or-later"
],
"authors": [
{
Expand Down Expand Up @@ -431,8 +437,14 @@
],
"support": {
"issues": "https://github.com/DeepDiver1975/PHPZipStreamer/issues",
"source": "https://github.com/DeepDiver1975/PHPZipStreamer/tree/master"
"source": "https://github.com/DeepDiver1975/PHPZipStreamer/tree/v2.0.3"
},
"funding": [
{
"url": "https://github.com/DeepDiver1975",
"type": "github"
}
],
"install-path": "../deepdiver/zipstreamer"
},
{
Expand Down
10 changes: 5 additions & 5 deletions composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'name' => 'nextcloud/3rdparty',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '9aabf1a490571ef88073d069222e9a232b772fc8',
'reference' => '6b178ba78e6e56dda78f3eec92e60d79e0812c99',
'type' => 'library',
'install_path' => __DIR__ . '/../',
'aliases' => array(),
Expand Down Expand Up @@ -65,9 +65,9 @@
'dev_requirement' => false,
),
'deepdiver/zipstreamer' => array(
'pretty_version' => '2.0.0',
'version' => '2.0.0.0',
'reference' => 'b8c59647ff34fb97e8937aefb2a65de2bc4b4755',
'pretty_version' => 'v2.0.3',
'version' => '2.0.3.0',
'reference' => 'b9d1f53453a5736285facb723252ea2169dc472e',
'type' => 'library',
'install_path' => __DIR__ . '/../deepdiver/zipstreamer',
'aliases' => array(),
Expand Down Expand Up @@ -310,7 +310,7 @@
'nextcloud/3rdparty' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '9aabf1a490571ef88073d069222e9a232b772fc8',
'reference' => '6b178ba78e6e56dda78f3eec92e60d79e0812c99',
'type' => 'library',
'install_path' => __DIR__ . '/../',
'aliases' => array(),
Expand Down
21 changes: 6 additions & 15 deletions deepdiver/zipstreamer/src/Count64.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
*
Expand Down Expand Up @@ -113,7 +104,7 @@ function unpack32le($data) {
*/
function pack64le($data) {
if (is_object($data)) {
if ("Count64_32" == get_class($data)) {
if (Count64_32::class == get_class($data)) {
$value = $data->_getValue();
$hiBytess = $value[0];
$loBytess = $value[1];
Expand Down Expand Up @@ -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);
}
}
2 changes: 1 addition & 1 deletion deepdiver/zipstreamer/src/Lib/Count64Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion deepdiver/zipstreamer/src/Lib/Count64_32.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 4 additions & 3 deletions deepdiver/zipstreamer/src/Lib/Count64_64.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}
Expand Down
28 changes: 14 additions & 14 deletions deepdiver/zipstreamer/src/ZipStreamer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -91,9 +91,9 @@ function __construct($options = NULL) {
$options = array_merge($defaultOptions, $options);

if ($options['outstream']) {
$this->outstream = $options['outstream'];
$this->outStream = $options['outstream'];
} else {
$this->outstream = fopen('php://output', 'w');
$this->outStream = fopen('php://output', 'w');
}
$this->zip64 = $options['zip64'];
$this->compress = $options['compress'];
Expand Down Expand Up @@ -156,7 +156,7 @@ public function sendHeaders($archiveName = 'archive.zip', $contentType = 'applic
header('Connection: Keep-Alive');
header('Content-Type: ' . $contentType);
// Use UTF-8 filenames when not using Internet Explorer
if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') > 0) {
if(isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') > 0) {
header('Content-Disposition: attachment; filename="' . rawurlencode($archiveName) . '"' );
} else {
header( 'Content-Disposition: attachment; filename*=UTF-8\'\'' . rawurlencode($archiveName)
Expand All @@ -175,7 +175,7 @@ public function sendHeaders($archiveName = 'archive.zip', $contentType = 'applic
/**
* Add a file to the archive at the specified location and file name.
*
* @param string $stream Stream to read data from
* @param resource $stream Stream to read data from
* @param string $filePath Filepath and name to be used in the archive.
* @param array $options Optional, additional options
* Valid options are:
Expand Down Expand Up @@ -322,11 +322,11 @@ private function validateCompressionOptions($compress, $level) {
}

private function write($data) {
return fwrite($this->outstream, $data);
return fwrite($this->outStream, $data);
}

private function flush() {
return fflush($this->outstream);
return fflush($this->outStream);
}

private function beginFile($filePath, $isDir, $fileComment, $timestamp, $gpFlags, $gzMethod,
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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)
}

0 comments on commit 1ce7a1b

Please sign in to comment.