summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.txt3
-rw-r--r--modules/openid/openid.module16
2 files changed, 18 insertions, 1 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index df3ddccd0..dac2e19a4 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,6 +1,9 @@
Drupal 7.22, xxxx-xx-xx (development version)
-----------------------
+- Fixed OpenID errors when more than one module implements hook_openid(). The
+ behavior is now changed so that if more than one module tries to set the same
+ parameter, the last module's change takes effect.
- Fixed a serious documentation bug: The $name variable in the
taxonomy-term.tpl.php theme template was incorrectly documented as being
sanitized when in fact it is not.
diff --git a/modules/openid/openid.module b/modules/openid/openid.module
index a3f4fc8e0..1f764e04b 100644
--- a/modules/openid/openid.module
+++ b/modules/openid/openid.module
@@ -787,7 +787,21 @@ function openid_authentication_request($claimed_id, $identity, $return_to = '',
$request = array_merge($request, module_invoke_all('openid', 'request', $request));
- return $request;
+ // module_invoke_all() uses array_merge_recursive() which might return nested
+ // arrays if two or more modules alter a given parameter, resulting in an
+ // invalid request format. To ensure this doesn't happen, we flatten the returned
+ // value by taking the last entry in the array if an array is returned.
+ $flattened_request = array();
+ foreach ($request as $key => $value) {
+ if (is_array($value)) {
+ $flattened_request[$key] = end($value);
+ }
+ else {
+ $flattened_request[$key] = $value;
+ }
+ }
+
+ return $flattened_request;
}
/**