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

[5.5] Change order of checks in JsonResponse #21136

Merged
merged 1 commit into from
Sep 12, 2017
Merged

[5.5] Change order of checks in JsonResponse #21136

merged 1 commit into from
Sep 12, 2017

Conversation

rodrigopedra
Copy link
Contributor

As stated in #21079 if you have a class implementing both Arrayable and Jsonable interface and have different returns for its toArray() and toJson() methods, the JsonResponse will prefer the toArray() return over toJson() return.

Before #17875, as the check was done inside the Response, the Jsonable implementation was checked before the Arrayable. So if we didn't explicitly returned a JsonResponse this wasn't a problem at all.

But after #17875 the Router checks the response type and creates a new JsonResponse which have a different logic as described above.

This PR brings the type-checking logic in JsonResponse to behave more likely as Response (check first for Jsonable then for Arrayable).

Please refer to #21079 for an example with different implementations of toArray() and toJson()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants