Skip to content

Commit ddb94cf

Browse files
committed
updated php-archive lib. fixes dokuwiki#2361
1 parent 10bf5c9 commit ddb94cf

File tree

6 files changed

+94
-72
lines changed

6 files changed

+94
-72
lines changed

composer.lock

+10-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/composer/installed.json

+56-53
Original file line numberDiff line numberDiff line change
@@ -188,59 +188,6 @@
188188
"description": "lesserphp is a compiler for LESS written in PHP based on leafo's lessphp.",
189189
"homepage": "http://leafo.net/lessphp/"
190190
},
191-
{
192-
"name": "splitbrain/php-archive",
193-
"version": "1.0.9",
194-
"version_normalized": "1.0.9.0",
195-
"source": {
196-
"type": "git",
197-
"url": "https://github.com/splitbrain/php-archive.git",
198-
"reference": "2a63b8cf0bfc7fdc0d987c9b7348e639e55cce76"
199-
},
200-
"dist": {
201-
"type": "zip",
202-
"url": "https://api.github.com/repos/splitbrain/php-archive/zipball/2a63b8cf0bfc7fdc0d987c9b7348e639e55cce76",
203-
"reference": "2a63b8cf0bfc7fdc0d987c9b7348e639e55cce76",
204-
"shasum": ""
205-
},
206-
"require": {
207-
"php": ">=5.3.0"
208-
},
209-
"require-dev": {
210-
"phpunit/phpunit": "4.5.*"
211-
},
212-
"suggest": {
213-
"ext-iconv": "Used for proper filename encode handling",
214-
"ext-mbstring": "Can be used alternatively for handling filename encoding"
215-
},
216-
"time": "2017-06-11T06:11:38+00:00",
217-
"type": "library",
218-
"installation-source": "dist",
219-
"autoload": {
220-
"psr-4": {
221-
"splitbrain\\PHPArchive\\": "src"
222-
}
223-
},
224-
"notification-url": "https://packagist.org/downloads/",
225-
"license": [
226-
"MIT"
227-
],
228-
"authors": [
229-
{
230-
"name": "Andreas Gohr",
231-
"email": "[email protected]"
232-
}
233-
],
234-
"description": "Pure-PHP implementation to read and write TAR and ZIP archives",
235-
"keywords": [
236-
"archive",
237-
"extract",
238-
"tar",
239-
"unpack",
240-
"unzip",
241-
"zip"
242-
]
243-
},
244191
{
245192
"name": "paragonie/random_compat",
246193
"version": "v2.0.12",
@@ -499,5 +446,61 @@
499446
"x.509",
500447
"x509"
501448
]
449+
},
450+
{
451+
"name": "splitbrain/php-archive",
452+
"version": "1.0.10",
453+
"version_normalized": "1.0.10.0",
454+
"source": {
455+
"type": "git",
456+
"url": "https://github.com/splitbrain/php-archive.git",
457+
"reference": "a46f3aaeb9f123fdb7db4e192b0600feebf7f773"
458+
},
459+
"dist": {
460+
"type": "zip",
461+
"url": "https://api.github.com/repos/splitbrain/php-archive/zipball/a46f3aaeb9f123fdb7db4e192b0600feebf7f773",
462+
"reference": "a46f3aaeb9f123fdb7db4e192b0600feebf7f773",
463+
"shasum": ""
464+
},
465+
"require": {
466+
"php": ">=5.4"
467+
},
468+
"require-dev": {
469+
"ext-bz2": "*",
470+
"ext-zip": "*",
471+
"mikey179/vfsstream": "^1.6",
472+
"phpunit/phpunit": "^4.8"
473+
},
474+
"suggest": {
475+
"ext-iconv": "Used for proper filename encode handling",
476+
"ext-mbstring": "Can be used alternatively for handling filename encoding"
477+
},
478+
"time": "2018-05-01T08:03:56+00:00",
479+
"type": "library",
480+
"installation-source": "dist",
481+
"autoload": {
482+
"psr-4": {
483+
"splitbrain\\PHPArchive\\": "src"
484+
}
485+
},
486+
"notification-url": "https://packagist.org/downloads/",
487+
"license": [
488+
"MIT"
489+
],
490+
"authors": [
491+
{
492+
"name": "Andreas Gohr",
493+
"email": "[email protected]"
494+
}
495+
],
496+
"description": "Pure-PHP implementation to read and write TAR and ZIP archives",
497+
"keywords": [
498+
"archive",
499+
"extract",
500+
"tar",
501+
"unpack",
502+
"unzip",
503+
"zip"
504+
]
502505
}
503506
]

vendor/splitbrain/php-archive/composer.json

+11-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"license": "MIT",
1212

1313
"require": {
14-
"php": ">=5.3.0"
14+
"php": ">=5.4"
1515
},
1616

1717
"suggest": {
@@ -20,12 +20,21 @@
2020
},
2121

2222
"require-dev": {
23-
"phpunit/phpunit": "4.5.*"
23+
"phpunit/phpunit": "^4.8",
24+
"mikey179/vfsStream": "^1.6",
25+
"ext-zip": "*",
26+
"ext-bz2": "*"
2427
},
2528

2629
"autoload": {
2730
"psr-4": {
2831
"splitbrain\\PHPArchive\\": "src"
2932
}
33+
},
34+
35+
"autoload-dev": {
36+
"psr-4": {
37+
"splitbrain\\PHPArchive\\": "tests"
38+
}
3039
}
3140
}

vendor/splitbrain/php-archive/phpunit.xml

+6-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,9 @@
1414
<directory suffix=".php">./tests/</directory>
1515
</testsuite>
1616
</testsuites>
17-
</phpunit>
17+
<filter>
18+
<whitelist processUncoveredFilesFromWhitelist="false">
19+
<directory suffix=".php">src</directory>
20+
</whitelist>
21+
</filter>
22+
</phpunit>

vendor/splitbrain/php-archive/src/Tar.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public function extract($outdir, $strip = '', $exclude = '', $include = '')
164164

165165
// extract data
166166
if (!$fileinfo->getIsdir()) {
167-
$fp = fopen($output, "wb");
167+
$fp = @fopen($output, "wb");
168168
if (!$fp) {
169169
throw new ArchiveIOException('Could not open file for writing: '.$output);
170170
}
@@ -245,7 +245,7 @@ public function addFile($file, $fileinfo = '')
245245
throw new ArchiveIOException('Archive has been closed, files can no longer be added');
246246
}
247247

248-
$fp = fopen($file, 'rb');
248+
$fp = @fopen($file, 'rb');
249249
if (!$fp) {
250250
throw new ArchiveIOException('Could not open file for reading: '.$file);
251251
}
@@ -379,7 +379,7 @@ public function save($file)
379379
$this->setCompression($this->complevel, $this->filetype($file));
380380
}
381381

382-
if (!file_put_contents($file, $this->getArchive())) {
382+
if (!@file_put_contents($file, $this->getArchive())) {
383383
throw new ArchiveIOException('Could not write to file: '.$file);
384384
}
385385
}
@@ -433,7 +433,7 @@ protected function writebytes($data)
433433
*
434434
* @param int $bytes seek to this position
435435
*/
436-
function skipbytes($bytes)
436+
protected function skipbytes($bytes)
437437
{
438438
if ($this->comptype === Archive::COMPRESS_GZIP) {
439439
@gzseek($this->fh, $bytes, SEEK_CUR);
@@ -645,7 +645,7 @@ public function filetype($file)
645645
{
646646
// for existing files, try to read the magic bytes
647647
if(file_exists($file) && is_readable($file) && filesize($file) > 5) {
648-
$fh = fopen($file, 'rb');
648+
$fh = @fopen($file, 'rb');
649649
if(!$fh) return false;
650650
$magic = fread($fh, 5);
651651
fclose($fh);

vendor/splitbrain/php-archive/src/Zip.php

+6-4
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public function contents()
111111
* @throws ArchiveIOException
112112
* @return FileInfo[]
113113
*/
114-
function extract($outdir, $strip = '', $exclude = '', $include = '')
114+
public function extract($outdir, $strip = '', $exclude = '', $include = '')
115115
{
116116
if ($this->closed || !$this->file) {
117117
throw new ArchiveIOException('Can not read from a closed archive');
@@ -163,7 +163,7 @@ function extract($outdir, $strip = '', $exclude = '', $include = '')
163163
}
164164

165165
// open file for writing
166-
$fp = fopen($extractto, "wb");
166+
$fp = @fopen($extractto, "wb");
167167
if (!$fp) {
168168
throw new ArchiveIOException('Could not open file for writing: '.$extractto);
169169
}
@@ -419,7 +419,7 @@ public function getArchive()
419419
*/
420420
public function save($file)
421421
{
422-
if (!file_put_contents($file, $this->getArchive())) {
422+
if (!@file_put_contents($file, $this->getArchive())) {
423423
throw new ArchiveIOException('Could not write to file: '.$file);
424424
}
425425
}
@@ -629,12 +629,14 @@ protected function header2fileinfo($header)
629629
* similar enough. CP437 seems not to be available in mbstring. Lastly falls back to keeping the
630630
* string as is, which is still better than nothing.
631631
*
632+
* On some systems iconv is available, but the codepage is not. We also check for that.
633+
*
632634
* @param $string
633635
* @return string
634636
*/
635637
protected function cpToUtf8($string)
636638
{
637-
if (function_exists('iconv')) {
639+
if (function_exists('iconv') && @iconv_strlen('', 'CP437') !== false) {
638640
return iconv('CP437', 'UTF-8', $string);
639641
} elseif (function_exists('mb_convert_encoding')) {
640642
return mb_convert_encoding($string, 'UTF-8', 'CP850');

0 commit comments

Comments
 (0)