From d89df359596987ff3f7f0fbdf2b5225cf0b8170d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Tue, 8 Aug 2017 11:40:16 +0200 Subject: [PATCH] [ticket/15305] Throw exception if stream_copy_to_stream() fail PHPBB3-15305 --- phpBB/language/en/common.php | 1 + phpBB/phpbb/storage/adapter/local.php | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 19a9a720cb..05de3c05bc 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -735,6 +735,7 @@ $lang = array_merge($lang, array( 'STORAGE_CANNOT_DELETE' => 'Can not delete file or folder.', 'STORAGE_CANNOT_RENAME' => 'Can not rename file or folder.', 'STORAGE_CANNOT_COPY' => 'Can not copy file or folder.', + 'STORAGE_CANNOT_COPY_RESOURCE' => 'Can not copy resource.', 'STORAGE_CANNOT_CREATE_DIR' => 'Can not create directory.', 'STORAGE_CANNOT_OPEN_FILE' => 'Can not open file.', 'STORAGE_CANNOT_CREATE_FILE' => 'Can not create file.', diff --git a/phpBB/phpbb/storage/adapter/local.php b/phpBB/phpbb/storage/adapter/local.php index 225f15c432..159c85b522 100644 --- a/phpBB/phpbb/storage/adapter/local.php +++ b/phpBB/phpbb/storage/adapter/local.php @@ -229,6 +229,9 @@ class local implements adapter_interface, stream_interface throw new exception('STORAGE_CANNOT_CREATE_FILE', $path); } - stream_copy_to_stream($resource, $stream); + if (stream_copy_to_stream($resource, $stream) === false) + { + throw new exception('STORAGE_CANNOT_COPY_RESOURCE'); + } } }