Skip to content
This repository has been archived by the owner on Nov 26, 2017. It is now read-only.

Commit

Permalink
Merge pull request #1773 from garyamort/remature-optimization
Browse files Browse the repository at this point in the history
Remature optimization
  • Loading branch information
ianmacl committed Dec 25, 2012
2 parents f587272 + d53e4e4 commit 4b6b8e8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions libraries/joomla/language/language.php
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 4b6b8e8

Please sign in to comment.