diff options
author | Jaime Perez Crespo <jaime.perez@uninett.no> | 2016-04-20 11:27:43 +0200 |
---|---|---|
committer | Jaime Perez Crespo <jaime.perez@uninett.no> | 2016-04-20 11:27:43 +0200 |
commit | deb9552c41497a46c176c0bb34302947d938a525 (patch) | |
tree | 11153eb9d6b37a09c675308045b2d7283f4789b4 | |
parent | 86a99f91bc0644d804b2503f6dd553ea16568551 (diff) | |
download | simplesamlphp-deb9552c41497a46c176c0bb34302947d938a525.zip simplesamlphp-deb9552c41497a46c176c0bb34302947d938a525.tar.gz simplesamlphp-deb9552c41497a46c176c0bb34302947d938a525.tar.bz2 |
Capture any output generated by a config file, throw it away and warn about it in the logs.
-rw-r--r-- | lib/SimpleSAML/Configuration.php | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/SimpleSAML/Configuration.php b/lib/SimpleSAML/Configuration.php index 62f25bf..fb2108d 100644 --- a/lib/SimpleSAML/Configuration.php +++ b/lib/SimpleSAML/Configuration.php @@ -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; } |