mirror of
https://github.com/Ne-Lexa/php-zip.git
synced 2025-08-03 14:07:23 +02:00
fix php 5.5 compat, fix append stream filter
This commit is contained in:
@@ -765,6 +765,11 @@ class ZipReader
|
||||
$filters[] = $encContextFilter;
|
||||
}
|
||||
|
||||
// hack, see https://groups.google.com/forum/#!topic/alt.comp.lang.php/37_JZeW63uc
|
||||
$pos = ftell($this->inStream);
|
||||
rewind($this->inStream);
|
||||
fseek($this->inStream, $pos);
|
||||
|
||||
$contextDecompress = null;
|
||||
switch ($compressionMethod) {
|
||||
case ZipCompressionMethod::STORED:
|
||||
|
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
/** @noinspection AdditionOperationOnArraysInspection */
|
||||
|
||||
/** @noinspection PhpUsageOfSilenceOperatorInspection */
|
||||
|
||||
namespace PhpZip;
|
||||
@@ -243,8 +244,8 @@ class ZipFile implements ZipFileInterface
|
||||
*
|
||||
* @param string $entryName
|
||||
*
|
||||
* @throws ZipEntryNotFoundException
|
||||
* @throws ZipException
|
||||
* @throws ZipEntryNotFoundException
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -259,8 +260,8 @@ class ZipFile implements ZipFileInterface
|
||||
* @param string $entryName
|
||||
* @param string|null $comment
|
||||
*
|
||||
* @throws ZipException
|
||||
* @throws ZipEntryNotFoundException
|
||||
* @throws ZipException
|
||||
*
|
||||
* @return ZipFile
|
||||
*/
|
||||
@@ -276,8 +277,8 @@ class ZipFile implements ZipFileInterface
|
||||
*
|
||||
* @param string $entryName
|
||||
*
|
||||
* @throws ZipException
|
||||
* @throws ZipEntryNotFoundException
|
||||
* @throws ZipException
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -295,8 +296,8 @@ class ZipFile implements ZipFileInterface
|
||||
/**
|
||||
* @param string $entryName
|
||||
*
|
||||
* @throws ZipException
|
||||
* @throws ZipEntryNotFoundException
|
||||
* @throws ZipException
|
||||
*
|
||||
* @return resource
|
||||
*/
|
||||
@@ -313,8 +314,8 @@ class ZipFile implements ZipFileInterface
|
||||
*
|
||||
* @param string|ZipEntry $entryName
|
||||
*
|
||||
* @throws ZipEntryNotFoundException
|
||||
* @throws ZipException
|
||||
* @throws ZipEntryNotFoundException
|
||||
*
|
||||
* @return ZipInfo
|
||||
*/
|
||||
@@ -395,19 +396,7 @@ class ZipFile implements ZipFileInterface
|
||||
|
||||
if (\is_array($entries)) {
|
||||
$entries = array_unique($entries);
|
||||
$flipEntries = array_flip($entries);
|
||||
$zipEntries = array_filter(
|
||||
$zipEntries,
|
||||
/**
|
||||
* @param string $entryName
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
static function ($entryName) use ($flipEntries) {
|
||||
return isset($flipEntries[$entryName]);
|
||||
},
|
||||
\ARRAY_FILTER_USE_KEY
|
||||
);
|
||||
$zipEntries = array_intersect_key($zipEntries, array_flip($entries));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user