Skip to content

Commit e0538fc

Browse files
committed
we need to update the datasize everythime ->data is updated
1 parent adbef91 commit e0538fc

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/LzwStreamWrapper.php

+3
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ public function stream_close()
274274
if (file_exists($this->tmp2)) unlink($this->tmp2);
275275
} else {
276276
$this->data = null;
277+
$this->dataSize = 0;
277278
}
278279
}
279280

@@ -339,6 +340,7 @@ public function stream_write($data)
339340
$postfix = substr($this->data, ($this->pointer + $count));
340341
$this->data = $prefix.$data.$postfix;
341342
$this->pointer += $count;
343+
$this->dataSize = strlen($this->data);
342344

343345
return $count;
344346
}
@@ -396,6 +398,7 @@ public function stream_truncate($new_size)
396398
} elseif ($new_size < $actual_data_size) {
397399
if ($this->tmp === null) {
398400
$this->data = substr($this->data, 0, $new_size);
401+
$this->dataSize = strlen($this->data);
399402
$this->writtenBytes = $new_size;
400403
} else {
401404
$fp = fopen($this->tmp, 'w'.(strpos($this->mode, 'b') !== 0

0 commit comments

Comments
 (0)