From 76dad297ffc4084d2057e2c2312f0c53f1e15f5b Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Mon, 20 Apr 2015 17:30:10 +0200 Subject: Fix encryption feof to not return too early This is because stream_read will pre-cache the next block which causes feof($this->source) to return true prematurely. So we cannot rely on it. Fixed encryption stream wrapper unit tests to actually simulate 6k/8k blocks to make sure we cover the matching logic. Added two data files with 8192 and 8193 bytes. --- lib/private/files/stream/encryption.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib') diff --git a/lib/private/files/stream/encryption.php b/lib/private/files/stream/encryption.php index 4a1df840105..083f8af9e50 100644 --- a/lib/private/files/stream/encryption.php +++ b/lib/private/files/stream/encryption.php @@ -243,6 +243,10 @@ class Encryption extends Wrapper { } + public function stream_eof() { + return $this->position >= $this->unencryptedSize; + } + public function stream_read($count) { $result = ''; -- cgit v1.2.3