diff options
author | David Rothstein <drothstein@gmail.com> | 2013-03-30 10:59:10 -0400 |
---|---|---|
committer | David Rothstein <drothstein@gmail.com> | 2013-03-30 10:59:10 -0400 |
commit | 0bcf41a3c45f095a5ecb43fa3ec437cab8e68830 (patch) | |
tree | c4bd4243472e35ffcf316b3011a30e7c8d2c356d /modules/openid | |
parent | 6cb8c8a05220a334ee8542097b48cf0a2a5dced2 (diff) | |
download | brdo-0bcf41a3c45f095a5ecb43fa3ec437cab8e68830.tar.gz brdo-0bcf41a3c45f095a5ecb43fa3ec437cab8e68830.tar.bz2 |
Issue #1379056 by Barrett: Fixed if more than one hook_openid() implementation returns a given parameter, the resulting value is an array and request is invalid.
Diffstat (limited to 'modules/openid')
-rw-r--r-- | modules/openid/openid.module | 16 |
1 files changed, 15 insertions, 1 deletions
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; } /** |