Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Commit63e7fe3

Browse files
committed
Merge branch 'hotfix/92'
Close#92Fix#41
2 parentsa582487 +063fca8 commit63e7fe3

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

‎CHANGELOG.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ All notable changes to this project will be documented in this file, in reverse
2525
-[#89](https://github.com/zendframework/zend-filter/pull/89) fixes infinite
2626
loop on malformed HTML comments in StripTags filter.
2727

28+
-[#92](https://github.com/zendframework/zend-filter/pull/92) fixes Tar adapter
29+
to not require`archive` in options when decompressing.
30+
2831
##2.9.1 - 2018-12-17
2932

3033
###Added

‎src/Compress/Tar.php‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,11 +202,12 @@ public function compress($content)
202202
publicfunctiondecompress($content)
203203
{
204204
$archive =$this->getArchive();
205-
if (empty($archive) || !file_exists($archive)) {
205+
if (file_exists($content)) {
206+
$archive =str_replace(['/','\\'],DIRECTORY_SEPARATOR,realpath($content));
207+
}elseif (empty($archive) || !file_exists($archive)) {
206208
thrownewException\RuntimeException('Tar Archive not found');
207209
}
208210

209-
$archive =str_replace(['/','\\'],DIRECTORY_SEPARATOR,realpath($content));
210211
$archive =newArchive_Tar($archive,$this->getMode());
211212
$target =$this->getTarget();
212213
if (!is_dir($target)) {

‎test/Compress/TarTest.php‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,4 +209,32 @@ public function testTarToString()
209209
$filter =newTarCompression();
210210
$this->assertEquals('Tar',$filter->toString());
211211
}
212+
213+
/**
214+
* @see https://github.com/zendframework/zend-filter/issues/41
215+
*/
216+
publicfunctiontestDecompressionDoesNotRequireArchive()
217+
{
218+
$filter =newTarCompression([
219+
'archive' =>$this->tmp .'/compressed.tar',
220+
'target' =>$this->tmp .'/zipextracted.txt',
221+
]);
222+
223+
$content ='compress me' .microtime(true);
224+
$compressed =$filter->compress($content);
225+
226+
self::assertSame($this->tmp .DIRECTORY_SEPARATOR .'compressed.tar',$compressed);
227+
228+
$target =$this->tmp;
229+
$filter =newTarCompression([
230+
'target' =>$target,
231+
]);
232+
233+
$decompressed =$filter->decompress($compressed);
234+
self::assertSame($target,$decompressed);
235+
// per documentation, tar includes full path
236+
$file =$target .DIRECTORY_SEPARATOR .$target .DIRECTORY_SEPARATOR .'/zipextracted.txt';
237+
self::assertFileExists($file);
238+
self::assertSame($content,file_get_contents($file));
239+
}
212240
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp