Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit 401679a

Browse files
committed
Fix metadata merge : use "+" operator only if keys are numeric, otherwise it breaks other metadata.
1 parent 4682bc0 commit 401679a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

core/src/plugins/metastore.serial/SerialMetaStore.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,11 @@ public function setMetadata($ajxpNode, $nameSpace, $metaData, $private = false,
8989
if (!isSet(self::$metaCache[$nameSpace])) {
9090
self::$metaCache[$nameSpace] = array();
9191
}
92-
self::$metaCache[$nameSpace] = self::$metaCache[$nameSpace] + $metaData;
92+
$hasNumericKeys = array_reduce(array_keys($metaData), function($carry, $item){
93+
return $carry && is_numeric($item);
94+
}, false);
95+
if($hasNumericKeys) self::$metaCache[$nameSpace] = self::$metaCache[$nameSpace] + $metaData;
96+
else self::$metaCache[$nameSpace] = array_merge(self::$metaCache[$nameSpace], $metaData);
9397
if(is_array(self::$metaCache[$nameSpace])){
9498
foreach(self::$metaCache[$nameSpace] as $k => $v){
9599
if($v == AJXP_VALUE_CLEAR) unset(self::$metaCache[$nameSpace][$k]);

0 commit comments

Comments
 (0)