Skip to content

Commit a7e52f5

Browse files
authored
Merge pull request #915 from Simperfit/hotfix/usage-of-php-constant
hotfix: change hardcoded value to php constant
2 parents 03cb43a + 3ca5e4a commit a7e52f5

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/Serializer/JsonEncoder.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace ApiPlatform\Core\Serializer;
1313

14-
use Symfony\Component\HttpFoundation\JsonResponse;
1514
use Symfony\Component\Serializer\Encoder\DecoderInterface;
1615
use Symfony\Component\Serializer\Encoder\EncoderInterface;
1716
use Symfony\Component\Serializer\Encoder\JsonDecode;
@@ -32,10 +31,9 @@ public function __construct(string $format, BaseJsonEncoder $jsonEncoder = null)
3231
{
3332
$this->format = $format;
3433

35-
// Encode <, >, ', &, and " for RFC4627-compliant JSON, which may also be embedded into HTML.
34+
// Encode <, >, ', &, and " characters in the JSON, making it also safe to be embedded into HTML.
3635
$this->jsonEncoder = $jsonEncoder ?: new BaseJsonEncoder(
37-
// The value "15" will be replaced by "JsonResponse::DEFAULT_ENCODING_OPTIONS" when Symfony HttpFoundation 2.7 support will be dropped
38-
new JsonEncode(15), new JsonDecode(true)
36+
new JsonEncode(JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT | JSON_UNESCAPED_UNICODE), new JsonDecode(true)
3937
);
4038
}
4139

0 commit comments

Comments
 (0)