From ac82674ff79432f9b5cee88c84371959f237bfd4 Mon Sep 17 00:00:00 2001
From: Jaime Perez Crespo <jaime.perez@uninett.no>
Date: Fri, 5 Feb 2016 14:32:25 +0100
Subject: [PATCH] Return lang_merge() to SimpleSAML_XHTML_Template, as it was
 public, and mark it as deprecated. Use array_merge_recursive() instead.

---
 lib/SimpleSAML/Locale/Translate.php | 14 +-------------
 lib/SimpleSAML/XHTML/Template.php   | 19 +++++++++++++++++++
 2 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/lib/SimpleSAML/Locale/Translate.php b/lib/SimpleSAML/Locale/Translate.php
index 0e4fe7c85..4f63fe354 100644
--- a/lib/SimpleSAML/Locale/Translate.php
+++ b/lib/SimpleSAML/Locale/Translate.php
@@ -365,7 +365,7 @@ class Translate
             $fileContent = file_get_contents($translationFile);
             $moreTrans = json_decode($fileContent, true);
             if (!empty($moreTrans)) {
-                $lang = self::lang_merge($lang, $moreTrans);
+                $lang = array_merge_recursive($lang, $moreTrans);
             }
         }
 
@@ -423,16 +423,4 @@ class Translate
         );
         return array();
     }
-
-
-    // Merge two translation arrays.
-    public static function lang_merge($def, $lang)
-    {
-        foreach ($def as $key => $value) {
-            if (array_key_exists($key, $lang)) {
-                $def[$key] = array_merge($value, $lang[$key]);
-            }
-        }
-        return $def;
-    }
 }
diff --git a/lib/SimpleSAML/XHTML/Template.php b/lib/SimpleSAML/XHTML/Template.php
index 2074810fc..c08017e58 100644
--- a/lib/SimpleSAML/XHTML/Template.php
+++ b/lib/SimpleSAML/XHTML/Template.php
@@ -78,6 +78,25 @@ class SimpleSAML_XHTML_Template
     }
 
 
+    /**
+     * Merge two translation arrays.
+     *
+     * @param array $def The array holding string definitions.
+     * @param array $lang The array holding translations for every string.
+     * @return array The recursive merge of both arrays.
+     * @deprecated This method will be removed in SimpleSAMLphp 2.0. Please use array_merge_recursive() instead.
+     */
+    public static function lang_merge($def, $lang)
+    {
+        foreach ($def as $key => $value) {
+            if (array_key_exists($key, $lang)) {
+                $def[$key] = array_merge($value, $lang[$key]);
+            }
+        }
+        return $def;
+    }
+
+
     /**
      * Find template path.
      *
-- 
GitLab