From 48742f334f3e2daa12cd0d41d9ecd72f13cfb061 Mon Sep 17 00:00:00 2001 From: Molkobain Date: Thu, 11 Aug 2022 11:38:13 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B05198=20-=20Add=20comment=20to=20clarify?= =?UTF-8?q?=20usage=20of=20array=5Freplace?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/ui.extkeywidget.class.inc.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/application/ui.extkeywidget.class.inc.php b/application/ui.extkeywidget.class.inc.php index 5f46a835d..242017e18 100644 --- a/application/ui.extkeywidget.class.inc.php +++ b/application/ui.extkeywidget.class.inc.php @@ -823,6 +823,8 @@ JS elseif (!in_array($sContains, $aValues)) { $aValuesEquals = $oValuesSet->GetValuesForAutocomplete(array('this' => $oObj, 'current_extkey_id' => $iCurrentExtKeyId), $sContains, 'equals'); + // Note: Here we cannot use array_merge as it would reindex the numeric keys starting from 0 when keys are actually the objects ID. + // As a workaround we use array_replace as it does preserve numeric keys. It's ok if some values from $aValuesEquals are replaced with values from $aValues as they contain the same data. $aValues = array_replace($aValuesEquals, $aValues); }