From 104876dd8e3ddb5cb46971a8e1be100ba7d9b432 Mon Sep 17 00:00:00 2001 From: Eddie Kohler Date: Mon, 28 Dec 2015 19:05:09 -0500 Subject: 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. --- ext/json/php_json.h | 1 + 1 file changed, 1 insertion(+) (limited to 'ext/json/php_json.h') diff --git a/ext/json/php_json.h b/ext/json/php_json.h index f1edc6c65a..d8bf0dfe9d 100644 --- a/ext/json/php_json.h +++ b/ext/json/php_json.h @@ -67,6 +67,7 @@ typedef enum { #define PHP_JSON_UNESCAPED_UNICODE (1<<8) #define PHP_JSON_PARTIAL_OUTPUT_ON_ERROR (1<<9) #define PHP_JSON_PRESERVE_ZERO_FRACTION (1<<10) +#define PHP_JSON_UNESCAPED_LINE_TERMINATORS (1<<11) /* json_decode() options */ #define PHP_JSON_OBJECT_AS_ARRAY (1<<0) -- cgit v1.2.1