Skip to content

Issue with AbstractProvider method parseResponse #1072

Description

@janikaja-tet

I have an issue with AbstractProvider method parseResponse: GitHub

PHP docs say that the method always returns array, but it's not true.
As you can see the method throws UnexpectedValueException only if it cannot parse JSON response with a correct header or if response status code is 500. In all other cases if JSON response cannot be parsed/decoded, the method returns the original response body that is a string value.
Now if the next method that is called by my code is prepareAccessTokenResponse, then a TypeError exception is thrown, because that method accepts only arrays, and we have a clear contradiction here!

My suggestion is that parseResponse method should always re-throw UnexpectedValueException when it cannot parse/decode the response regardless of the reason (with a different message explaining the reason).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions