* 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.
This commit is contained in:
Ralf Becker 2018-09-06 12:02:28 +02:00
parent 070ba2b617
commit 58703cbaba

View File

@ -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);