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
Media upload fails when user wants to decode json as array #756
Comments
Interesting. Thanks for the PR. I'm wondering if maybe it would be better to allow |
I agree with you that casting is not the best solution. Did the CI build fail because of this? I used casting because |
Currently the tests hit the live Twitter API so Travis will only run them when I create the PRs to avoid anyone from exfiltrating the credentials. #671 will fix this. I'm not sure yet if overriding decodeJsonAsArray is the right pattern but I also don't like casting types. |
This is the twitteroauth/src/TwitterOAuth.php Lines 414 to 415 in 6cc1b31
it could be something like this: $response = JsonDecoder::decode($result, false);
$this->response->setBody(JsonDecoder::decode($result, $this->decodeJsonAsArray)); and then in all API methods return |
The problem is still actual :) |
TwitterOAuth is in maintenance mode and major improvements are no longer planned. #1188 |
Hello, I found this bug because in my codebase I set the library to decode json responses as array with
setDecodeJsonAsArray(true)
.Doing so breaks the chunked media upload, because it consists of multiple separate calls and the method
uploadMediaChunked()
internally gives for granted that responses arestdClass
objects.see PR #755
The text was updated successfully, but these errors were encountered: