From d53e4e48230073b623a5968ca293ee1f0502c075 Mon Sep 17 00:00:00 2001 From: "Gary A. Mort" Date: Mon, 24 Dec 2012 09:32:44 -0500 Subject: [PATCH] Rebase and re-apply ksort --- libraries/joomla/language/language.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libraries/joomla/language/language.php b/libraries/joomla/language/language.php index 88bc2d09df..a7fd7b8457 100644 --- a/libraries/joomla/language/language.php +++ b/libraries/joomla/language/language.php @@ -177,6 +177,8 @@ public function __construct($lang = null, $debug = false) { if (is_array($contents)) { + // Sort the underlying heap by key values to optimize merging + ksort($contents, SORT_STRING); $this->override = $contents; } unset($contents); @@ -769,11 +771,14 @@ protected function loadLanguage($filename, $extension = 'unknown') { if (is_array($strings)) { + // Sort the underlying heap by key values to optimize merging + ksort($strings, SORT_STRING); $this->strings = array_merge($this->strings, $strings); } if (is_array($strings) && count($strings)) { + // Do not bother with ksort here. Since the originals were sorted, PHP will already have chosen the best heap. $this->strings = array_merge($this->strings, $this->override); $result = true; }