From 3cff50bc2f67235695573c4abb577156b032eb29 Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Mon, 11 Mar 2019 09:25:51 +0100 Subject: [PATCH] MVC, php union operator seems to be bugggy, closes https://github.com/opnsense/core/pull/3301 --- .../models/OPNsense/Base/FieldTypes/ModelRelationField.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/ModelRelationField.php b/src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/ModelRelationField.php index 522bd9228..faeaac1c9 100644 --- a/src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/ModelRelationField.php +++ b/src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/ModelRelationField.php @@ -211,7 +211,12 @@ class ModelRelationField extends BaseField $datanodes = explode(',', $this->internalValue); if ($this->internalIsSorted) { - $optKeys = $datanodes + array_keys(self::$internalOptionList[$this->internalCacheKey]); + $optKeys = $datanodes; + foreach (array_keys(self::$internalOptionList[$this->internalCacheKey]) as $key) { + if (!in_array($key, $optKeys)) { + $optKeys[] = $key; + } + } } else { $optKeys = array_keys(self::$internalOptionList[$this->internalCacheKey]); }