8000 JsonResponse fix by kanariezwart · Pull Request #16689 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

JsonResponse fix #16689

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

Closed
wants to merge 3 commits into from
Closed

JsonResponse fix #16689

wants to merge 3 commits into from

Conversation

kanariezwart
Copy link
Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #16541
License MIT
Doc PR

Please also consider closed PR discussions:
#16551
#16563

Changed $this->data to an container for setting or adding scalar content to ResponseObject. $this->content is a string representation of $this->data.
$this->update() is an private function to sync $this->data and $this->content. When modifying either $data or $content or by setting encoding options, the two are synced.
Changed $this->update() to sync this->data and $this->content
Updated JsonResponse after feedback
@kanariezwart
Copy link
Author

@stof take three. Thank for the feedback. I think this attempt is a bit less intrusive.
@xabbuh please consider the rework of PR #16563

*/
public function setData($data = array())
{
$this->data = $data;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are still breaking BC by storing the array/object/scalar instead of storing the JSON string.

And it might even break things in case your data is a mutable object, as your data could be mutated before you trigger another update

@fabpot
Copy link
Member
fabpot commented Jan 27, 2016

Closing as this breaks BC.

@fabpot fabpot closed this Jan 27, 2016
@kanariezwart kanariezwart deleted the jsonresponse-fix branch February 9, 2016 12:25
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.

3 participants
0