From 5c6ec386e2567c0d59da8f4c7accac9e35e3f51c Mon Sep 17 00:00:00 2001 From: Jaime Perez Crespo <jaime.perez@uninett.no> Date: Tue, 2 Feb 2016 14:25:21 +0100 Subject: [PATCH] Bugfix: if an optional configuration is missing, we shouldn't register it to reuse it later (i.e. loading a config file as optional first and as mandatory later would make the second call to work -while it shouldn't-, since an empty config was loaded during the first call). --- lib/SimpleSAML/Configuration.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/SimpleSAML/Configuration.php b/lib/SimpleSAML/Configuration.php index 9536baabe..32a8da715 100644 --- a/lib/SimpleSAML/Configuration.php +++ b/lib/SimpleSAML/Configuration.php @@ -121,8 +121,10 @@ class SimpleSAML_Configuration // file does not exist, but is required throw new Exception('Missing configuration file: '.$filename); } else { - // file does not exist, but is optional - $config = array(); + // file does not exist, but is optional, so return an empty configuration object without saving it + $cfg = new SimpleSAML_Configuration(array(), $filename); + $cfg->filename = $filename; + return $cfg; } $cfg = new SimpleSAML_Configuration($config, $filename); -- GitLab