Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Twitter responds with json but oauth exception thinks its a string and doesn't parse it #1239

Open
maryalbanese opened this issue Oct 30, 2024 · 0 comments

Comments

@maryalbanese
Copy link

In twitterOauth.php if there is an exception in the call to this:

$result = $this->oAuthRequest($url, 'POST', $parameters);

returns JSON instead of a simple string as shown here

{"errors":[{"code":415,"message":"Callback URL not approved for this client application. Approved callback URLs can be adjusted in your application settings"}]}

So the code then throws an exception with $result as the exception message instead of parsing the json.
so that e->message is
"errors":[{"code":415,"message":"Callback URL not approved for this client application. Approved callback URLs can be adjusted in your application settings"}]

The added double quotes inside the message causes problems when outputing what is assumed to be a string

Expected behavior
On exception e->message should be a simple string, not json

Actual behavior
e->message is json

Versions:

  • TwitterOAuth: [e.g. v4.0.1]
  • PHP: v [e.g. v7.4.33]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant