Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Use unescaped slashes in encoded JSON by default #98

Merged
merged 3 commits into from
Oct 16, 2015

Conversation

weierophinney
Copy link
Member

Updated the default $encodingOptions to also include JSON_UNESCAPED_SLASHES, which is a sane default, and still complies with RFC 4627 (forward slash, or the solidus, does not need to be escaped).

- Updated the default `$encodingOptions` to also include
  `JSON_UNESCAPED_SLASHES`, which is a sane default, and still complies
  with RFC 4627 (forward slash, or the solidus, does not need to be
  escaped).
@weierophinney weierophinney added this to the 1.1.4 milestone Oct 15, 2015
@@ -41,7 +42,7 @@ class JsonResponse extends Response
* @param int $encodingOptions JSON encoding options to use.
* @throws InvalidArgumentException if unable to encode the $data to JSON.
*/
public function __construct($data, $status = 200, array $headers = [], $encodingOptions = 15)
public function __construct($data, $status = 200, array $headers = [], $encodingOptions = 79)
Copy link
Member

Choose a reason for hiding this comment

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

That last hardcoded number bothers me a lot. Can it be moved to a class constant?

@weierophinney
Copy link
Member Author

@Ocramius done. :)

@ezimuel ezimuel merged commit 7af31d3 into zendframework:master Oct 16, 2015
@weierophinney weierophinney deleted the hotfix/json-default-flags branch October 16, 2015 15:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants