summaryrefslogtreecommitdiff
path: root/ext/json/json.c
diff options
context:
space:
mode:
authorEddie Kohler <ekohler@gmail.com>2015-12-28 19:05:09 -0500
committerJakub Zelenka <bukka@php.net>2016-01-22 19:40:58 +0000
commit104876dd8e3ddb5cb46971a8e1be100ba7d9b432 (patch)
treea0b589bd2ca0f14a7b30d47181b5a998f2218687 /ext/json/json.c
parent9b854ebab4ddd729a878b094268f639d2fa7b228 (diff)
downloadphp-git-104876dd8e3ddb5cb46971a8e1be100ba7d9b432.tar.gz
json_encode: Escape U+2028 and U+2029 more often.
These characters are illegal in Javascript, so leaving them unescaped is risky. The default encoder ($flags = 0) is fine, but the encoder with JSON_UNESCAPED_UNICODE flag is not. In case anyone wants the ability to leave these characters unescaped, provide JSON_UNESCAPED_LINE_TERMINATORS.
Diffstat (limited to 'ext/json/json.c')
-rw-r--r--ext/json/json.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/ext/json/json.c b/ext/json/json.c
index 20bbcdc59e..971fe15f05 100644
--- a/ext/json/json.c
+++ b/ext/json/json.c
@@ -117,6 +117,7 @@ static PHP_MINIT_FUNCTION(json)
PHP_JSON_REGISTER_CONSTANT("JSON_UNESCAPED_UNICODE", PHP_JSON_UNESCAPED_UNICODE);
PHP_JSON_REGISTER_CONSTANT("JSON_PARTIAL_OUTPUT_ON_ERROR", PHP_JSON_PARTIAL_OUTPUT_ON_ERROR);
PHP_JSON_REGISTER_CONSTANT("JSON_PRESERVE_ZERO_FRACTION", PHP_JSON_PRESERVE_ZERO_FRACTION);
+ PHP_JSON_REGISTER_CONSTANT("JSON_UNESCAPED_LINE_TERMINATORS", PHP_JSON_UNESCAPED_LINE_TERMINATORS);
/* options for json_decode */
PHP_JSON_REGISTER_CONSTANT("JSON_OBJECT_AS_ARRAY", PHP_JSON_OBJECT_AS_ARRAY);