diff options
author | Vincent Petry <vincent@nextcloud.com> | 2022-08-04 10:55:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-04 10:55:12 +0200 |
commit | 5d697b54f7e0af5950031fe8e46bdf800c108d86 (patch) | |
tree | 23651a7d68a25ad3082aa7a65debda44d8190a62 /lib | |
parent | 7e7dcdaf178ba55bdd6af65cfe70aca72c7c3096 (diff) | |
parent | 89cb450c8434f7a51f5fa88b68449d8be71b6c4e (diff) | |
download | nextcloud-server-5d697b54f7e0af5950031fe8e46bdf800c108d86.tar.gz nextcloud-server-5d697b54f7e0af5950031fe8e46bdf800c108d86.zip |
Merge pull request #33447 from nextcloud/bugfix/noid/detect-leading-spaces-in-config
Detect leading spaces in config files
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Config.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/private/Config.php b/lib/private/Config.php index b044d0731a3..37708357339 100644 --- a/lib/private/Config.php +++ b/lib/private/Config.php @@ -231,6 +231,14 @@ class Config { 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); } |