diff --git a/core/includes/module.inc b/core/includes/module.inc index dff74b6..da84e76 100644 --- a/core/includes/module.inc +++ b/core/includes/module.inc @@ -818,7 +818,7 @@ function module_invoke_all($hook) { if (function_exists($function)) { $result = call_user_func_array($function, $args); if (isset($result) && is_array($result)) { - $return = array_merge_recursive($return, $result); + $return = drupal_array_merge_deep($return, $result); } elseif (isset($result)) { $return[] = $result; diff --git a/core/modules/rdf/rdf.module b/core/modules/rdf/rdf.module index b2a8457..92363a1 100644 --- a/core/modules/rdf/rdf.module +++ b/core/modules/rdf/rdf.module @@ -95,23 +95,22 @@ function rdf_rdf_namespaces() { * hook_rdf_namespaces(). */ function rdf_get_namespaces() { - $rdf_namespaces = module_invoke_all('rdf_namespaces'); - // module_invoke_all() uses array_merge_recursive() which might return nested - // arrays if several modules redefine the same prefix multiple times. We need - // to ensure the array of namespaces is flat and only contains strings as - // URIs. - foreach ($rdf_namespaces as $prefix => $uri) { - if (is_array($uri)) { - if (count(array_unique($uri)) == 1) { - // All namespaces declared for this prefix are the same, merge them all - // into a single namespace. - $rdf_namespaces[$prefix] = $uri[0]; - } - else { - // There are conflicting namespaces for this prefix, do not include - // duplicates in order to avoid asserting any inaccurate RDF - // statements. - unset($rdf_namespaces[$prefix]); + // Do the equivalent of module_invoke_all('rdf_namespaces'), but exclude + // prefixes for which different modules define conflicting URIs. + $rdf_namespaces = array(); + $conflicts = array(); + foreach (module_implements('rdf_namespaces') as $module) { + $function = $module . '_rdf_namespaces'; + $result = $function(); + if (is_array($result)) { + foreach ($result as $prefix => $uri) { + if (isset($rdf_namespaces[$prefix]) && $rdf_namespaces[$prefix] !== $uri) { + $conflicts[$prefix] = TRUE; + unset($rdf_namespaces[$prefix]); + } + if (!isset($conflicts[$prefix])) { + $rdf_namespaces[$prefix] = $uri; + } } } } @@ -672,7 +671,7 @@ function rdf_preprocess_username(&$variables) { // (see http://www.w3.org/TR/rdfa-syntax/#rdfa-attributes). // Therefore, merge rather than override so as not to clobber values set by // earlier preprocess functions. - $variables['attributes_array'] = array_merge_recursive($variables['attributes_array'], $attributes); + $variables['attributes_array'] = drupal_array_merge_deep($variables['attributes_array'], $attributes); } /**