[ticket/15692] Check if argument is a valid resource

PHPBB3-15692
This commit is contained in:
Rubén Calvo 2018-08-07 00:18:25 +02:00
parent 071d5fe997
commit 5fbe929a1d
2 changed files with 6 additions and 0 deletions

View file

@ -745,6 +745,7 @@ $lang = array_merge($lang, array(
'STORAGE_CANNOT_CREATE_DIR' => 'Can not create directory.',
'STORAGE_CANNOT_OPEN_FILE' => 'Can not open file.',
'STORAGE_CANNOT_CREATE_FILE' => 'Can not create file.',
'STORAGE_INVALID_RESOURCE' => 'Resource is invalid.',
'TB' => 'TB',
'TERMS_LINK' => 'Terms',

View file

@ -271,6 +271,11 @@ class storage
throw new exception('STORAGE_FILE_EXISTS', $path);
}
if (!is_resource($resource))
{
throw new exception('STORAGE_INVALID_RESOURCE');
}
$adapter = $this->get_adapter();
if ($adapter instanceof stream_interface)