diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index b6dbc4bec2..cb40ac547e 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -187,7 +187,10 @@ class acp_database $storage->write_stream($file, $fp); - fclose($fp); + if (is_resource($fp)) + { + fclose($fp); + } $storage->track_file($file); diff --git a/phpBB/phpbb/attachment/upload.php b/phpBB/phpbb/attachment/upload.php index 8d4b68c7be..b4e59f5c1f 100644 --- a/phpBB/phpbb/attachment/upload.php +++ b/phpBB/phpbb/attachment/upload.php @@ -246,8 +246,14 @@ class upload { // Move the thumbnail from temp folder to the storage $fp = fopen($destination, 'rb'); + $this->storage->write_stream($destination_name, $fp); - fclose($fp); + + if (is_resource($fp)) + { + fclose($fp); + } + $this->storage->track_file($destination_name); } else diff --git a/phpBB/phpbb/files/filespec_storage.php b/phpBB/phpbb/files/filespec_storage.php index a6870c4a05..49c9618844 100644 --- a/phpBB/phpbb/files/filespec_storage.php +++ b/phpBB/phpbb/files/filespec_storage.php @@ -445,8 +445,14 @@ class filespec_storage try { $fp = fopen($this->filename, 'rb'); + $storage->write_stream($this->destination_file, $fp); - fclose($fp); + + if (is_resource($fp)) + { + fclose($fp); + } + $storage->track_file($this->destination_file); } catch (\phpbb\storage\exception\exception $e)