fixed bug that wouldnt allow creation of folders name 0

This commit is contained in:
Chris
2020-01-11 02:32:53 +01:00
parent 76c0f6cec1
commit c4087c1e84

View File

@@ -87,12 +87,15 @@ class FTPStorage implements StorageController
{
if(!$this->connect()) return false;
@ftp_chdir($this->connection, FTP_BASEDIR);
$parts = array_filter(explode('/',$ftpath));
$parts = array_filter(explode('/',$ftpath), function($value) {
return ($value !== null && $value !== false && $value !== '');
});
foreach($parts as $part){
if(!@ftp_chdir($this->connection, $part)){
ftp_mkdir($this->connection, $part);
ftp_chdir($this->connection, $part);
}
$part = strval($part);
if(!@ftp_chdir($this->connection, $part)){
ftp_mkdir($this->connection, $part);
ftp_chdir($this->connection, $part);
}
}
}