Skip to content

Commit

Permalink
Harden some PHP functions
Browse files Browse the repository at this point in the history
To avoid things like #26034
  • Loading branch information
solracsf authored Jan 11, 2022
1 parent 796764a commit 746d5f6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions apps/settings/lib/Controller/CheckSetupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ private function isCorrectMemcachedPHPModuleInstalled() {
return true;
}

// there are two different memcached modules for PHP
// there are two different memcache modules for PHP
// we only support memcached and not memcache
// https://code.google.com/p/memcached/wiki/PHPClientComparison
return !(!extension_loaded('memcached') && extension_loaded('memcache'));
Expand All @@ -375,7 +375,7 @@ private function isCorrectMemcachedPHPModuleInstalled() {
*/
private function isSettimelimitAvailable() {
if (function_exists('set_time_limit')
&& strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
&& strpos(ini_get('disable_functions'), 'set_time_limit') === false) {
return true;
}

Expand Down Expand Up @@ -769,14 +769,14 @@ protected function isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed(): bool {
return true;
}

$tempPath = sys_get_temp_dir();
$tempPath = ini_get('upload_tmp_dir') ? ini_get('upload_tmp_dir') : sys_get_temp_dir();
if (!is_dir($tempPath)) {
$this->logger->error('Error while checking the temporary PHP path - it was not properly set to a directory. value: ' . $tempPath);
return false;
}
$freeSpaceInTemp = disk_free_space($tempPath);
$freeSpaceInTemp = function_exists('disk_free_space') ? disk_free_space($tempPath) : false;
if ($freeSpaceInTemp === false) {
$this->logger->error('Error while checking the available disk space of temporary PHP path - no free disk space returned. temporary path: ' . $tempPath);
$this->logger->error('Error while checking the available disk space of temporary PHP path - no free disk space returned. Temporary path: ' . $tempPath);
return false;
}

Expand Down

0 comments on commit 746d5f6

Please sign in to comment.