diff --git a/phpBB/phpbb/attachment/upload.php b/phpBB/phpbb/attachment/upload.php index ca83f9dabf..7cd94d0858 100644 --- a/phpBB/phpbb/attachment/upload.php +++ b/phpBB/phpbb/attachment/upload.php @@ -296,8 +296,10 @@ class upload */ protected function check_disk_space() { - if ($free_space = @disk_free_space($this->phpbb_root_path . $this->config['upload_path'])) + if (function_exists('disk_free_space')) { + $free_space = @disk_free_space($this->phpbb_root_path); + if ($free_space <= $this->file->get('filesize')) { if ($this->auth->acl_get('a_')) diff --git a/tests/attachment/upload_test.php b/tests/attachment/upload_test.php index 9a30a20b23..c26efd5094 100644 --- a/tests/attachment/upload_test.php +++ b/tests/attachment/upload_test.php @@ -79,6 +79,7 @@ class phpbb_attachment_upload_test extends \phpbb_database_test_case 'img_create_thumbnail' => true, )); $config = $this->config; + $this->phpbb_root_path = $phpbb_root_path; $this->db = $this->new_dbal(); $this->cache = new \phpbb\cache\service(new \phpbb\cache\driver\dummy(), $this->config, $this->db, $phpbb_root_path, $phpEx); $this->request = $this->createMock('\phpbb\request\request');