Skip to content
Snippets Groups Projects
Commit deb9552c authored by Jaime Perez Crespo's avatar Jaime Perez Crespo
Browse files

Capture any output generated by a config file, throw it away and warn about it in the logs.

parent 86a99f91
No related merge requests found
......@@ -107,11 +107,15 @@ class SimpleSAML_Configuration
return self::$loadedConfigs[$filename];
}
$spurious_output = false;
if (file_exists($filename)) {
$config = 'UNINITIALIZED';
// the file initializes a variable named '$config'
ob_start();
require($filename);
$spurious_output = ob_get_length() > 0;
ob_end_clean();
// check that $config exists
if (!isset($config)) {
......@@ -151,6 +155,12 @@ class SimpleSAML_Configuration
self::$loadedConfigs[$filename] = $cfg;
if ($spurious_output) {
SimpleSAML\Logger::warning(
"The configuration file '$filename' generates output. Please review your configuration."
);
}
return $cfg;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment