John Erck - 2013-07-12 18:10:19
Hi Manuel,
I found a bug on line 1263 and 1264 in oauth_client.php, v1.66 that results in the incorrect parsing of the server's response.
The following server response 'Content-Type' values: 'text/plain' (line 1263) and 'text/html' (line 1264) are both being parsed with parse_str (http://php.net/manual/en/function.parse-str.php) which is designed to parse URL query string arguments (query string format example: "first=value&arr[]=foo+bar&arr[]=baz").
'text/plain' and 'text/html' do not match the URL query string format parse_str expects.
'text/plain' should fall through to the switch's default (i.e. return the string unparsed). 'text/html' should either also fall through to the switch's default or maybe be parsed as html using PHP's DOM (http://www.php.net/manual/en/book.dom.php).
Commenting out lines 1263 and 1264 did the trick for me. Now when I var_dump($response) from callAPI(/*args*/, $response) I get a nice readable string from 'text/plain' server responses rather than an array with garbled content.
Your OAuth Client package is awesome. Hope this helps improve it. Thanks.