Skip to content

Commit

Permalink
Merge pull request #33447 from nextcloud/bugfix/noid/detect-leading-s…
Browse files Browse the repository at this point in the history
…paces-in-config

Detect leading spaces in config files
  • Loading branch information
PVince81 authored Aug 4, 2022
2 parents 7e7dcda + 89cb450 commit 5d697b5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/private/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,14 @@ private function readData() {

unset($CONFIG);
include $file;
if (!defined('PHPUNIT_RUN') && headers_sent()) {
// syntax issues in the config file like leading spaces causing PHP to send output
$errorMessage = sprintf('Config file has leading content, please remove everything before "<?php" in %s', basename($file));
if (!defined('OC_CONSOLE')) {
print(\OCP\Util::sanitizeHTML($errorMessage));
}
throw new \Exception($errorMessage);
}
if (isset($CONFIG) && is_array($CONFIG)) {
$this->cache = array_merge($this->cache, $CONFIG);
}
Expand Down

0 comments on commit 5d697b5

Please sign in to comment.