diff --git a/phpBB/phpbb/storage/adapter/local.php b/phpBB/phpbb/storage/adapter/local.php index 6471194090..94990a6bf7 100644 --- a/phpBB/phpbb/storage/adapter/local.php +++ b/phpBB/phpbb/storage/adapter/local.php @@ -428,9 +428,16 @@ class local implements adapter_interface, stream_interface */ public function free_space() { - $free_space = @disk_free_space($this->root_path); + if (function_exists('disk_free_space')) + { + $free_space = @disk_free_space($this->root_path); - if ($free_space === false) + if ($free_space === false) + { + throw new exception('STORAGE_CANNOT_GET_FREE_SPACE'); + } + } + else { throw new exception('STORAGE_CANNOT_GET_FREE_SPACE'); } diff --git a/tests/attachment/upload_test.php b/tests/attachment/upload_test.php index 47edd102c9..6e47ef35ee 100644 --- a/tests/attachment/upload_test.php +++ b/tests/attachment/upload_test.php @@ -85,6 +85,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');