Permalink
Browse files

Fix metadata merge : use "+" operator only if keys are numeric, other…

…wise it breaks other metadata.
  • Loading branch information...
1 parent 4682bc0 commit 401679a7e6812b789ee583f48218ecc3edc4259f @cdujeu cdujeu committed Oct 10, 2016
Showing with 5 additions and 1 deletion.
  1. +5 −1 core/src/plugins/metastore.serial/SerialMetaStore.php
@@ -89,7 +89,11 @@ public function setMetadata($ajxpNode, $nameSpace, $metaData, $private = false,
if (!isSet(self::$metaCache[$nameSpace])) {
self::$metaCache[$nameSpace] = array();
}
- self::$metaCache[$nameSpace] = self::$metaCache[$nameSpace] + $metaData;
+ $hasNumericKeys = array_reduce(array_keys($metaData), function($carry, $item){
+ return $carry && is_numeric($item);
+ }, false);
+ if($hasNumericKeys) self::$metaCache[$nameSpace] = self::$metaCache[$nameSpace] + $metaData;
+ else self::$metaCache[$nameSpace] = array_merge(self::$metaCache[$nameSpace], $metaData);
if(is_array(self::$metaCache[$nameSpace])){
foreach(self::$metaCache[$nameSpace] as $k => $v){
if($v == AJXP_VALUE_CLEAR) unset(self::$metaCache[$nameSpace][$k]);

0 comments on commit 401679a

Please sign in to comment.