From 00938c25898303dde7f40b1315afbcbb4859d49f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Tue, 21 Aug 2018 00:22:47 +0200 Subject: [PATCH 1/2] [ticket/15760] Fix write_stream PHPBB3-15760 --- phpBB/includes/acp/acp_database.php | 2 -- phpBB/phpbb/attachment/upload.php | 2 -- phpBB/phpbb/files/filespec_storage.php | 2 -- phpBB/phpbb/storage/adapter/local.php | 2 ++ phpBB/phpbb/storage/storage.php | 1 + 5 files changed, 3 insertions(+), 6 deletions(-) diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index cb40ac547e..bd9f767d39 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -192,8 +192,6 @@ class acp_database fclose($fp); } - $storage->track_file($file); - // Remove file from tmp @unlink($temp_dir . '/' . $file); diff --git a/phpBB/phpbb/attachment/upload.php b/phpBB/phpbb/attachment/upload.php index 6202798e05..37978944aa 100644 --- a/phpBB/phpbb/attachment/upload.php +++ b/phpBB/phpbb/attachment/upload.php @@ -254,8 +254,6 @@ class upload { 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 5f3b895a05..adf4135193 100644 --- a/phpBB/phpbb/files/filespec_storage.php +++ b/phpBB/phpbb/files/filespec_storage.php @@ -456,8 +456,6 @@ class filespec_storage { fclose($fp); } - - $storage->track_file($this->destination_file); } catch (\phpbb\storage\exception\exception $e) { diff --git a/phpBB/phpbb/storage/adapter/local.php b/phpBB/phpbb/storage/adapter/local.php index c7fbe544e9..70df8043c8 100644 --- a/phpBB/phpbb/storage/adapter/local.php +++ b/phpBB/phpbb/storage/adapter/local.php @@ -348,6 +348,8 @@ class local implements adapter_interface, stream_interface fclose($stream); throw new exception('STORAGE_CANNOT_COPY_RESOURCE'); } + + fclose($stream); } /** diff --git a/phpBB/phpbb/storage/storage.php b/phpBB/phpbb/storage/storage.php index 97d71048ee..869c84b3eb 100644 --- a/phpBB/phpbb/storage/storage.php +++ b/phpBB/phpbb/storage/storage.php @@ -226,6 +226,7 @@ class storage if ($adapter instanceof stream_interface) { $adapter->write_stream($path, $resource); + $this->track_file($path); } else { From f225d85acf17f4a76489d31a1fa9792a6616d63d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Tue, 21 Aug 2018 03:50:09 +0200 Subject: [PATCH 2/2] [ticket/15760] Remove comment PHPBB3-15760 --- phpBB/phpbb/storage/storage.php | 1 - 1 file changed, 1 deletion(-) diff --git a/phpBB/phpbb/storage/storage.php b/phpBB/phpbb/storage/storage.php index 869c84b3eb..7f9a7fdbb0 100644 --- a/phpBB/phpbb/storage/storage.php +++ b/phpBB/phpbb/storage/storage.php @@ -212,7 +212,6 @@ class storage /** * Writes a new file using a stream - * The file needs to be tracked after using this method * * @param string $path The target file * @param resource $resource The resource