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;
|
$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;
|
$contextDecompress = null;
|
||||||
switch ($compressionMethod) {
|
switch ($compressionMethod) {
|
||||||
case ZipCompressionMethod::STORED:
|
case ZipCompressionMethod::STORED:
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/** @noinspection AdditionOperationOnArraysInspection */
|
/** @noinspection AdditionOperationOnArraysInspection */
|
||||||
|
|
||||||
/** @noinspection PhpUsageOfSilenceOperatorInspection */
|
/** @noinspection PhpUsageOfSilenceOperatorInspection */
|
||||||
|
|
||||||
namespace PhpZip;
|
namespace PhpZip;
|
||||||
@@ -243,8 +244,8 @@ class ZipFile implements ZipFileInterface
|
|||||||
*
|
*
|
||||||
* @param string $entryName
|
* @param string $entryName
|
||||||
*
|
*
|
||||||
* @throws ZipEntryNotFoundException
|
|
||||||
* @throws ZipException
|
* @throws ZipException
|
||||||
|
* @throws ZipEntryNotFoundException
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
@@ -259,8 +260,8 @@ class ZipFile implements ZipFileInterface
|
|||||||
* @param string $entryName
|
* @param string $entryName
|
||||||
* @param string|null $comment
|
* @param string|null $comment
|
||||||
*
|
*
|
||||||
* @throws ZipException
|
|
||||||
* @throws ZipEntryNotFoundException
|
* @throws ZipEntryNotFoundException
|
||||||
|
* @throws ZipException
|
||||||
*
|
*
|
||||||
* @return ZipFile
|
* @return ZipFile
|
||||||
*/
|
*/
|
||||||
@@ -276,8 +277,8 @@ class ZipFile implements ZipFileInterface
|
|||||||
*
|
*
|
||||||
* @param string $entryName
|
* @param string $entryName
|
||||||
*
|
*
|
||||||
* @throws ZipException
|
|
||||||
* @throws ZipEntryNotFoundException
|
* @throws ZipEntryNotFoundException
|
||||||
|
* @throws ZipException
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
@@ -295,8 +296,8 @@ class ZipFile implements ZipFileInterface
|
|||||||
/**
|
/**
|
||||||
* @param string $entryName
|
* @param string $entryName
|
||||||
*
|
*
|
||||||
* @throws ZipException
|
|
||||||
* @throws ZipEntryNotFoundException
|
* @throws ZipEntryNotFoundException
|
||||||
|
* @throws ZipException
|
||||||
*
|
*
|
||||||
* @return resource
|
* @return resource
|
||||||
*/
|
*/
|
||||||
@@ -313,8 +314,8 @@ class ZipFile implements ZipFileInterface
|
|||||||
*
|
*
|
||||||
* @param string|ZipEntry $entryName
|
* @param string|ZipEntry $entryName
|
||||||
*
|
*
|
||||||
* @throws ZipEntryNotFoundException
|
|
||||||
* @throws ZipException
|
* @throws ZipException
|
||||||
|
* @throws ZipEntryNotFoundException
|
||||||
*
|
*
|
||||||
* @return ZipInfo
|
* @return ZipInfo
|
||||||
*/
|
*/
|
||||||
@@ -395,19 +396,7 @@ class ZipFile implements ZipFileInterface
|
|||||||
|
|
||||||
if (\is_array($entries)) {
|
if (\is_array($entries)) {
|
||||||
$entries = array_unique($entries);
|
$entries = array_unique($entries);
|
||||||
$flipEntries = array_flip($entries);
|
$zipEntries = array_intersect_key($zipEntries, 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
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user