From 811444dc98b66a305057d9f7205b58929f4067f6 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 6 Sep 2018 12:02:28 +0200 Subject: [PATCH] * Filemanager/SMB: fix directory creation failed on Samba (smbclient PHP extension) smbclient treats every non-zero value of $options parameter as recursive, not just &1 and we have by default &8 = STREAM_REPORT_ERRORS set. --- api/src/Vfs/StreamWrapper.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/api/src/Vfs/StreamWrapper.php b/api/src/Vfs/StreamWrapper.php index 35135c7645..c4b32f5758 100644 --- a/api/src/Vfs/StreamWrapper.php +++ b/api/src/Vfs/StreamWrapper.php @@ -652,10 +652,17 @@ class StreamWrapper implements StreamWrapperIface !($this->url_stat($parent_url, STREAM_URL_STAT_QUIET)) && Vfs::parse_url($parent_url, PHP_URL_PATH) !== '/') { - if (!mkdir($parent_url, $mode, $options)) return false; + if (!self::mkdir(Vfs::dirname($path), $mode, $options)) return false; } // unset it now, as it was handled above - $options &= ~STREAM_MKDIR_RECURSIVE; + if (strpos($url, 'smb://') === 0) + { + $options = 0; // smbclient php extension treats every bit as recursive + } + else + { + $options &= ~STREAM_MKDIR_RECURSIVE; + } $ret = mkdir($url,$mode,$options);