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

Commit

Permalink
Fix metadata merge : use "+" operator only if keys are numeric, other…
Browse files Browse the repository at this point in the history
…wise it breaks other metadata.
  • Loading branch information
cdujeu committed Oct 10, 2016
1 parent 4682bc0 commit 401679a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/src/plugins/metastore.serial/SerialMetaStore.php
Expand Up @@ -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]);
Expand Down

0 comments on commit 401679a

Please sign in to comment.