From: Bjoern Schiessle Date: Wed, 18 Dec 2013 14:40:43 +0000 (+0100) Subject: implement ftell stream wrapper and fix return value from fseek stream wrapper X-Git-Tag: v7.0.0alpha2~1003^2~3 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d9668977cd23a3989a412ba3412240bf3cf38c94;p=nextcloud-server.git implement ftell stream wrapper and fix return value from fseek stream wrapper --- 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); }