Skip to content

Commit a8eb9c9

Browse files
committed
Leave underlying stream open
1 parent 9e39aa6 commit a8eb9c9

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

ChangeLog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ ZIP File support for the XP Framework ChangeLog
33

44
## ?.?.? / ????-??-??
55

6+
## 11.3.0 / 2025-12-12
7+
8+
* Merged PR #7: Refactor encryption, adding AES-128, -192 and -256 write
9+
support
10+
(@thekid)
611
* Merged PR #6: Support listing entries (with encrypted content) without
712
password by deferring verification until content stream is accessed
813
(@thekid)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ public function close() {
249249
$l+= strlen($s);
250250
$this->stream->write($s);
251251
}
252-
252+
253253
// End of central directory
254254
$this->stream->write(self::EOCD);
255255
$this->stream->write(pack(

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ public function close() {
7676
$this->name
7777
);
7878
$out= $encryption->out($this->writer, $crc32);
79+
while ($this->data->available()) {
80+
$out->write($this->data->read());
81+
}
82+
$out->close();
7983
} else {
8084
$this->writer->addEntry(
8185
0,
@@ -87,13 +91,12 @@ public function close() {
8791
$this->name,
8892
''
8993
);
90-
$out= $this->writer->stream;
94+
while ($this->data->available()) {
95+
$this->writer->stream->write($this->data->read());
96+
}
97+
// Leave underlying stream open
9198
}
9299

93-
while ($this->data->available()) {
94-
$out->write($this->data->read());
95-
}
96-
$out->close();
97100
$this->data= null;
98101
}
99102
}

0 commit comments

Comments
 (0)