]> granicus.if.org Git - php/commit
json_encode: Escape U+2028 and U+2029 more often.
authorEddie Kohler <ekohler@gmail.com>
Tue, 29 Dec 2015 00:05:09 +0000 (19:05 -0500)
committerJakub Zelenka <bukka@php.net>
Fri, 22 Jan 2016 19:40:58 +0000 (19:40 +0000)
commit104876dd8e3ddb5cb46971a8e1be100ba7d9b432
treea0b589bd2ca0f14a7b30d47181b5a998f2218687
parent9b854ebab4ddd729a878b094268f639d2fa7b228
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/json.c
ext/json/json_encoder.c
ext/json/php_json.h
ext/json/tests/json_encode_u2028_u2029.phpt [new file with mode: 0644]