From f9a64d2b2755ba2d63677c0d9846e87790292d4c Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Fri, 15 Nov 2013 14:23:24 +0100 Subject: [PATCH] Fix for smb4php fseek The stream_fseek function must return a boolean which will be mapped to 0 for success and -1 for failure for the caller. This patch fixes stream_fseek of smb4php to also respect this convention. Since the encryption app is relying on fseek to detect whether a file is encrypted by reading the last bit of data, this will fix #5023 --- apps/files_external/3rdparty/smb4php/smb.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/files_external/3rdparty/smb4php/smb.php b/apps/files_external/3rdparty/smb4php/smb.php index e91b0a59581..1a6cd05590c 100644 --- a/apps/files_external/3rdparty/smb4php/smb.php +++ b/apps/files_external/3rdparty/smb4php/smb.php @@ -460,7 +460,8 @@ class smb_stream_wrapper extends smb { function stream_tell () { return ftell($this->stream); } - function stream_seek ($offset, $whence=null) { return fseek($this->stream, $offset, $whence); } + // PATCH: the wrapper must return true when fseek succeeded by returning 0. + function stream_seek ($offset, $whence=null) { return fseek($this->stream, $offset, $whence) === 0; } function stream_flush () { if ($this->mode <> 'r' && $this->need_flush) {