mirror of
https://github.com/nextcloud/server.git
synced 2024-09-02 05:55:17 +02:00
Detect leading spaces in config files
Because those will cause PHP to output to stdout and will cause unrelated error messages. Signed-off-by: Vincent Petry <vincent@nextcloud.com>
This commit is contained in:
parent
9475cc02b2
commit
89cb450c84
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user