Hello again, I was pleased to see the termie-fangle branch got merged into trunk. It fixes many issues, however query-parameter-arrays are still not supported in the oauth PHP lib. The attached patch resolves this issue; it'd be great if you can review and merge it.
cheers, robin PS. Here's an example: URL: ...?do[oauth]=requesttoken base-url: do%5Boauth%5D=requesttoken&oauth_... base-string: ...&do%255Boauth%255D%3Drequesttoken%26oauth_... The OAuth PHP lib SVN r908 neglects the array key and computes a wrong base-url: &do%3Drequesttoken%26oauth_... The http_url:private of OAauth.php is correct: ...?do%5Boauth%5D=requesttoken&... FWIW: I've also tested attached patch with multidimensional arrays: eg. ?test[1][2][3]=4 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "OAuth" group. To post to this group, send email to oauth@googlegroups.com To unsubscribe from this group, send email to oauth+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/oauth?hl=en -~----------~----~----~----~------~----~------~--~---
--- /home/rgareus/src/svn/oauth/code/php/OAuth.php 2009-03-09 15:28:30.000000000 +0100 +++ OAuth.php 2009-03-09 15:28:11.000000000 +0100 @@ -245,6 +245,17 @@ return $this->parameters; }/*}}}*/ + private function recurse_param_array($params, $k, $v) {/*{{{*/ + foreach($v as $ak => $av) { + if (is_array($av)) { + $this->recurse_param_array(&$params, $k.'['.$ak.']', $av); + } else { + $params[$k.'['.$ak.']']=$av; + } + } + return $params; + }/*}}}*/ + /** * Returns the normalized parameters of the request * @@ -265,10 +276,17 @@ if (isset($params['oauth_signature'])) { unset($params['oauth_signature']); } + + foreach($params as $k => $v) { + if (is_array($v)) { + unset($params[$k]); + $this->recurse_param_array(&$params, $k, $v); + } + } // Urlencode both keys and values - $keys = OAuthUtil::urlencode_rfc3986(array_keys($params)); - $values = OAuthUtil::urlencode_rfc3986(array_values($params)); + $keys = array_map(array('OAuthUtil', 'urlencode_rfc3986'), array_keys($params)); + $values = array_map(array('OAuthUtil', 'urlencode_rfc3986'), array_values($params)); $params = array_combine($keys, $values); // Sort by keys (natsort)