From d9668977cd23a3989a412ba3412240bf3cf38c94 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Wed, 18 Dec 2013 15:40:43 +0100 Subject: [PATCH] implement ftell stream wrapper and fix return value from fseek stream wrapper --- apps/files_encryption/lib/stream.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/apps/files_encryption/lib/stream.php b/apps/files_encryption/lib/stream.php index 7a37d2200a4..c3cbdd54f56 100644 --- a/apps/files_encryption/lib/stream.php +++ b/apps/files_encryption/lib/stream.php @@ -163,15 +163,26 @@ class Stream { } + /** + * @brief Returns the current position of the file pointer + * @return int position of the file pointer + */ + public function stream_tell() { + return ftell($this->handle); + } + /** * @param $offset * @param int $whence + * @return bool true if fseek was successful, otherwise false */ public function stream_seek($offset, $whence = SEEK_SET) { $this->flush(); - fseek($this->handle, $offset, $whence); + // this wrapper needs to return "true" for success. + // the fseek call itself returns 0 on succeess + return !fseek($this->handle, $offset, $whence); } -- 2.39.5