From c859264108276f6bace2255a4ad78e20f5765493 Mon Sep 17 00:00:00 2001
From: Tim van Dijen <tvdijen@gmail.com>
Date: Thu, 6 Jan 2022 18:22:44 +0100
Subject: [PATCH] Remove references to defaultDictionary; Closes #1541

---
 lib/SimpleSAML/Error/Error.php        | 2 +-
 lib/SimpleSAML/Locale/Translate.php   | 4 +---
 lib/SimpleSAML/XHTML/IdPDisco.php     | 2 +-
 lib/SimpleSAML/XHTML/Template.php     | 5 ++---
 modules/admin/lib/Controller/Test.php | 2 +-
 modules/core/lib/Controller/Login.php | 2 +-
 modules/cron/lib/Controller/Cron.php  | 4 ++--
 7 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/lib/SimpleSAML/Error/Error.php b/lib/SimpleSAML/Error/Error.php
index 21c0da472..f5a4b2d28 100644
--- a/lib/SimpleSAML/Error/Error.php
+++ b/lib/SimpleSAML/Error/Error.php
@@ -269,7 +269,7 @@ class Error extends Exception
             call_user_func($show_function, $config, $data);
             Assert::true(false);
         } else {
-            $t = new Template($config, 'error.twig', 'errors');
+            $t = new Template($config, 'error.twig');
 
             // Include translations for the module that holds the included template
             if ($this->includeTemplate !== null) {
diff --git a/lib/SimpleSAML/Locale/Translate.php b/lib/SimpleSAML/Locale/Translate.php
index eaa58c123..f8468dd03 100644
--- a/lib/SimpleSAML/Locale/Translate.php
+++ b/lib/SimpleSAML/Locale/Translate.php
@@ -37,13 +37,11 @@ class Translate
      * Constructor
      *
      * @param \SimpleSAML\Configuration $configuration Configuration object
-     * @param string|null $defaultDictionary The default dictionary where tags will come from.
      */
-    public function __construct(Configuration $configuration, ?string $defaultDictionary = null)
+    public function __construct(Configuration $configuration)
     {
         $this->configuration = $configuration;
         $this->language = new Language($configuration);
-        $this->defaultDictionary = $defaultDictionary;
     }
 
 
diff --git a/lib/SimpleSAML/XHTML/IdPDisco.php b/lib/SimpleSAML/XHTML/IdPDisco.php
index 39d475e87..5abcd97c3 100644
--- a/lib/SimpleSAML/XHTML/IdPDisco.php
+++ b/lib/SimpleSAML/XHTML/IdPDisco.php
@@ -587,7 +587,7 @@ class IdPDisco
                 throw new \Exception('Invalid value for the \'idpdisco.layout\' option.');
         }
 
-        $t = new Template($this->config, $templateFile, 'disco');
+        $t = new Template($this->config, $templateFile);
 
         $newlist = [];
         foreach ($idpList as $entityid => $data) {
diff --git a/lib/SimpleSAML/XHTML/Template.php b/lib/SimpleSAML/XHTML/Template.php
index 768e36bd0..bb18d8f2c 100644
--- a/lib/SimpleSAML/XHTML/Template.php
+++ b/lib/SimpleSAML/XHTML/Template.php
@@ -116,9 +116,8 @@ class Template extends Response
      *
      * @param \SimpleSAML\Configuration $configuration Configuration object
      * @param string                   $template Which template file to load
-     * @param string|null              $defaultDictionary The default dictionary where tags will come from.
      */
-    public function __construct(Configuration $configuration, string $template, string $defaultDictionary = null)
+    public function __construct(Configuration $configuration, string $template)
     {
         $this->configuration = $configuration;
         $this->template = $template;
@@ -134,7 +133,7 @@ class Template extends Response
         );
 
         // initialize internationalization system
-        $this->translator = new Translate($configuration, $defaultDictionary);
+        $this->translator = new Translate($configuration);
         $this->localization = new Localization($configuration);
 
         // check if we need to attach a theme controller
diff --git a/modules/admin/lib/Controller/Test.php b/modules/admin/lib/Controller/Test.php
index c74462d2d..44845142c 100644
--- a/modules/admin/lib/Controller/Test.php
+++ b/modules/admin/lib/Controller/Test.php
@@ -145,7 +145,7 @@ class Test
             $nameId = $authsource->getAuthData('saml:sp:NameID') ?? false;
 
             $httpUtils = new Utils\HTTP();
-            $t = new Template($this->config, 'admin:status.twig', 'attributes');
+            $t = new Template($this->config, 'admin:status.twig');
             $l = $t->getLocalization();
             $l->addAttributeDomains();
             $t->data = [
diff --git a/modules/core/lib/Controller/Login.php b/modules/core/lib/Controller/Login.php
index 50a4f3cb0..db4f724b7 100644
--- a/modules/core/lib/Controller/Login.php
+++ b/modules/core/lib/Controller/Login.php
@@ -89,7 +89,7 @@ class Login
 
         $session = Session::getSessionFromRequest();
 
-        $t = new Template($this->config, 'auth_status.twig', 'attributes');
+        $t = new Template($this->config, 'auth_status.twig');
         $l = $t->getLocalization();
         $l->addAttributeDomains();
         $t->data['header'] = '{status:header_saml20_sp}';
diff --git a/modules/cron/lib/Controller/Cron.php b/modules/cron/lib/Controller/Cron.php
index f90e0e116..114d2261e 100644
--- a/modules/cron/lib/Controller/Cron.php
+++ b/modules/cron/lib/Controller/Cron.php
@@ -105,7 +105,7 @@ class Cron
             ];
         }
 
-        $t = new Template($this->config, 'cron:croninfo.twig', 'cron:cron');
+        $t = new Template($this->config, 'cron:croninfo.twig');
         $t->data['urls'] = $urls;
         return $t;
     }
@@ -157,7 +157,7 @@ class Cron
         }
 
         if ($output === 'xhtml') {
-            $t = new Template($this->config, 'cron:croninfo-result.twig', 'cron:cron');
+            $t = new Template($this->config, 'cron:croninfo-result.twig');
             $t->data['tag'] = $croninfo['tag'];
             $t->data['time'] = $time;
             $t->data['url'] = $url;
-- 
GitLab