source: src/router/php7/ext/json/tests/json_encode_u2028_u2029.phpt @ 31874

Last change on this file since 31874 was 31874, checked in by brainslayer, 4 months ago

update php

File size: 1.3 KB
Line 
1--TEST--
2json_encode() tests for U+2028, U+2029
3--SKIPIF--
4<?php if (!extension_loaded("json")) print "skip"; ?>
5--FILE--
6<?php
7var_dump(json_encode(array("a\xC3\xA1b")));
8var_dump(json_encode(array("a\xC3\xA1b"), JSON_UNESCAPED_UNICODE));
9var_dump(json_encode("a\xE2\x80\xA7b"));
10var_dump(json_encode("a\xE2\x80\xA7b", JSON_UNESCAPED_UNICODE));
11var_dump(json_encode("a\xE2\x80\xA8b"));
12var_dump(json_encode("a\xE2\x80\xA8b", JSON_UNESCAPED_UNICODE));
13var_dump(json_encode("a\xE2\x80\xA8b", JSON_UNESCAPED_LINE_TERMINATORS));
14var_dump(json_encode("a\xE2\x80\xA8b", JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_LINE_TERMINATORS));
15var_dump(json_encode("a\xE2\x80\xA9b"));
16var_dump(json_encode("a\xE2\x80\xA9b", JSON_UNESCAPED_UNICODE));
17var_dump(json_encode("a\xE2\x80\xA9b", JSON_UNESCAPED_LINE_TERMINATORS));
18var_dump(json_encode("a\xE2\x80\xA9b", JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_LINE_TERMINATORS));
19var_dump(json_encode("a\xE2\x80\xAAb"));
20var_dump(json_encode("a\xE2\x80\xAAb", JSON_UNESCAPED_UNICODE));
21?>
22--EXPECT--
23string(12) "["a\u00e1b"]"
24string(8) "["aáb"]"
25string(10) ""a\u2027b""
26string(7) ""a‧b""
27string(10) ""a\u2028b""
28string(10) ""a\u2028b""
29string(10) ""a\u2028b""
30string(7) ""a‹b""
31string(10) ""a\u2029b""
32string(10) ""a\u2029b""
33string(10) ""a\u2029b""
34string(7) ""a
b""
35string(10) ""a\u202ab""
36string(7) ""a‪b""
Note: See TracBrowser for help on using the repository browser.