summaryrefslogtreecommitdiff
path: root/inc/parserutils.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/parserutils.php')
-rw-r--r--inc/parserutils.php19
1 files changed, 14 insertions, 5 deletions
diff --git a/inc/parserutils.php b/inc/parserutils.php
index 20f992ba2..54ccb05f3 100644
--- a/inc/parserutils.php
+++ b/inc/parserutils.php
@@ -386,9 +386,18 @@ function p_set_metadata($id, $data, $render=false, $persistent=true){
if ($key == 'relation'){
foreach ($value as $subkey => $subvalue){
- $meta['current'][$key][$subkey] = !empty($meta['current'][$key][$subkey]) ? array_merge($meta['current'][$key][$subkey], $subvalue) : $subvalue;
- if ($persistent)
- $meta['persistent'][$key][$subkey] = !empty($meta['persistent'][$key][$subkey]) ? array_merge($meta['persistent'][$key][$subkey], $subvalue) : $subvalue;
+ if(isset($meta['current'][$key][$subkey]) && is_array($meta['current'][$key][$subkey])) {
+ $meta['current'][$key][$subkey] = array_merge($meta['current'][$key][$subkey], (array)$subvalue);
+ } else {
+ $meta['current'][$key][$subkey] = $subvalue;
+ }
+ if($persistent) {
+ if(isset($meta['persistent'][$key][$subkey]) && is_array($meta['persistent'][$key][$subkey])) {
+ $meta['persistent'][$key][$subkey] = array_merge($meta['persistent'][$key][$subkey], (array)$subvalue);
+ } else {
+ $meta['persistent'][$key][$subkey] = $subvalue;
+ }
+ }
}
// be careful with some senisitive arrays of $meta
@@ -396,10 +405,10 @@ function p_set_metadata($id, $data, $render=false, $persistent=true){
// these keys, must have subkeys - a legitimate value must be an array
if (is_array($value)) {
- $meta['current'][$key] = !empty($meta['current'][$key]) ? array_merge($meta['current'][$key],$value) : $value;
+ $meta['current'][$key] = !empty($meta['current'][$key]) ? array_merge((array)$meta['current'][$key],$value) : $value;
if ($persistent) {
- $meta['persistent'][$key] = !empty($meta['persistent'][$key]) ? array_merge($meta['persistent'][$key],$value) : $value;
+ $meta['persistent'][$key] = !empty($meta['persistent'][$key]) ? array_merge((array)$meta['persistent'][$key],$value) : $value;
}
}