Skip to content

Commit 421d7a8

Browse files
committed
Refactor common stream creation code
1 parent c065086 commit 421d7a8

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/main/php/io/archive/zip/AbstractZipReaderImpl.class.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,10 @@ public function currentEntry() {
221221
$this->skip= $header['compressed'] + 16;
222222
}
223223

224+
$stream= new ZipFileInputStream($this, $this->position, $header['compressed']);
225+
224226
// AES vs. traditional PKZIP cipher
225227
if (99 === $header['compression']) {
226-
$stream= new ZipFileInputStream($this, $this->position, $header['compressed']);
227228
$aes= unpack('vheader/vsize/vversion/a2vendor/cstrength/vcompression', $extra);
228229
$header['compression']= $aes['compression'];
229230
$is= function() use($header, $stream, $aes) {
@@ -253,7 +254,6 @@ public function currentEntry() {
253254
);
254255
};
255256
} else if ($header['flags'] & 1) {
256-
$stream= new ZipFileInputStream($this, $this->position, $header['compressed']);
257257
$is= function() use($header, $stream) {
258258
if (null === $this->password) {
259259
throw new IllegalAccessException('No password set');
@@ -270,7 +270,6 @@ public function currentEntry() {
270270
return new DecipheringInputStream($stream, $cipher);
271271
};
272272
} else {
273-
$stream= new ZipFileInputStream($this, $this->position, $header['compressed']);
274273
$is= function() use($stream) { return $stream; };
275274
}
276275

0 commit comments

Comments
 (0)