Skip to content

Commit 2cd65c6

Browse files
committed
Performance patch.
Only check each unique value ONCE.
1 parent 8814977 commit 2cd65c6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Loader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* License: GNU/GPLv2
99
* @see LICENSE.txt
1010
*
11-
* This file: The loader (last modified: 2023.04.03).
11+
* This file: The loader (last modified: 2023.04.04).
1212
*/
1313

1414
namespace phpMussel\Core;
@@ -773,7 +773,7 @@ public function parse(array $Needles, string $Haystack = '', bool $L10N = false)
773773
return '';
774774
}
775775
if ($L10N && preg_match_all('~\{([A-Za-z\d_ -]+)\}~', $Haystack, $Matches)) {
776-
foreach ($Matches[1] as $Key) {
776+
foreach (array_unique($Matches[1]) as $Key) {
777777
if (($Value = $this->L10N->getString($Key)) !== '') {
778778
$Haystack = str_replace('{' . $Key . '}', $Value, $Haystack);
779779
}

0 commit comments

Comments
 (0)