Commit Graph

399 Commits

Author SHA1 Message Date
Nikita Popov
4831e150c5 Fixed bug #77843 2019-04-23 12:43:07 +02:00
Peter Kokot
f1d7e3ca0b Sync leading and final newlines in *.phpt sections
This patch adds missing newlines, trims multiple redundant final
newlines into a single one, and trims redundant leading newlines in all
*.phpt sections.

According to POSIX, a line is a sequence of zero or more non-' <newline>'
characters plus a terminating '<newline>' character. [1] Files should
normally have at least one final newline character.

C89 [2] and later standards [3] mention a final newline:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character."

Although it is not mandatory for all files to have a final newline
fixed, a more consistent and homogeneous approach brings less of commit
differences issues and a better development experience in certain text
editors and IDEs.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
[2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2
[3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
2018-10-15 04:31:31 +02:00
Peter Kokot
17ccbeec32 Trim trailing whitespace in *.phpt 2018-10-14 19:44:14 +02:00
Peter Kokot
60a69daec6 Sync leading and final newlines in source code files
This patch adds missing newlines, trims multiple redundant final
newlines into a single one, and trims redundant leading newlines.

According to POSIX, a line is a sequence of zero or more non-' <newline>'
characters plus a terminating '<newline>' character. [1] Files should
normally have at least one final newline character.

C89 [2] and later standards [3] mention a final newline:
"A source file that is not empty shall end in a new-line character,
which shall not be immediately preceded by a backslash character."

Although it is not mandatory for all files to have a final newline
fixed, a more consistent and homogeneous approach brings less of commit
differences issues and a better development experience in certain text
editors and IDEs.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206
[2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2
[3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
2018-10-14 12:54:08 +02:00
Peter Kokot
902d39a3a7 Trim trailing whitespace in source code files 2018-10-13 14:14:50 +02:00
Xinchen Hui
7a7ec01a49 year++ 2018-01-02 12:55:14 +08:00
Jakub Zelenka
84aad458ca Merge branch 'PHP-7.1' into PHP-7.2 2017-12-30 17:41:45 +00:00
Jakub Zelenka
2fd0b994dd Use seialize_precision instead of precision in all json tests 2017-12-30 17:34:01 +00:00
Jakub Zelenka
7c556c44a1 Fix bug #68567 (JSON_PARTIAL_OUTPUT_ON_ERROR can result in JSON with null key) 2017-10-15 19:36:15 +01:00
Xinchen Hui
21f049b45c Prevent from being affected by local php.ini 2017-10-13 18:23:56 +08:00
Jakub Zelenka
e53dd027c5 Reset utf8_invalid in json scanner 2017-08-10 19:47:58 +01:00
Jakub Zelenka
f5b4cb7130 Fix possible overflow in json scanner utf8_invalid_count 2017-08-10 19:40:02 +01:00
Darek Slusarczyk
abd97b8bcb Merge branch 'PHP-7.1' into PHP-7.2
# Conflicts:
#	ext/json/config.w32
2017-08-08 16:08:19 +02:00
Darek Slusarczyk
86aa1ca990 Merge branch 'PHP-7.0' into PHP-7.1 2017-08-08 16:05:13 +02:00
Darek Slusarczyk
618dcd6520 JSON: fix config.w32 / Install headers on windows 2017-08-08 15:52:53 +02:00
Jakub Zelenka
41d7621f48 Fix segfault in json ignoring of invalid UTF8 2017-08-06 17:20:31 +01:00
Jakub Zelenka
18180bb161 Bump PHP_JSON_VERSION to 1.6.0 2017-07-16 15:53:02 +01:00
Jakub Zelenka
0f047f60f0 [ci skip] Remove CSV leftovers from json code - $Id$ 2017-07-16 15:51:39 +01:00
Jakub Zelenka
9c58822653 Introduce internal php_json_encode_ex to allow extensions setting depth 2017-07-16 15:47:23 +01:00
Jakub Zelenka
0d0f7cde8c Add JSON_INVALID_UTF8_SUBSTITUTE and JSON_INVALID_UTF8_IGNORE
It implements request #65082 and adds options for replacing resp.
ignoring invalid UTF-8 sequences for json_encode and json_decode.
2017-07-16 12:35:24 +01:00
Dmitry Stogov
9c2a1f52a5 Avoid useless dereferences and separations during paramter passing. 2017-06-19 12:55:59 +03:00
Dmitry Stogov
6fe75aad6d Optimization for fast path. 2017-06-19 10:07:11 +03:00
Jakub Zelenka
bfa9362d43 Merge branch 'PHP-7.0' into PHP-7.1 2017-06-18 18:28:54 +01:00
Jakub Zelenka
887fabe78f Regenerate and bump re2c version to 0.16
It also matches the re2c version for Zend language scanner
2017-06-18 18:26:48 +01:00
Jakub Zelenka
8ec45be8db Merge branch 'PHP-7.1' 2017-06-18 18:32:19 +01:00
Dmitry Stogov
1385784f54 Fixed performance degradaton introduced in f6ac96b 2017-06-13 12:20:14 +03:00
Jakub Zelenka
f6ac96b039 Improve and simplify UTF-8 validation in JSON 2017-06-11 17:27:32 +01:00
Dmitry Stogov
13ee8fd626 Improved UTF-8 validation in JSON 2017-05-25 01:16:17 +03:00
Craig Duncan
16202b7d67 Don't suppress warnings in tests 2017-04-02 00:58:56 +02:00
Sara Golemon
aa2282df21 Allow JSON_OBJECT_AS_ARRAY option to actually have meaning
Options can only be passed if $assoc is passed, but passing
assoc clobbers any attempt to pass JSON_OBJECT_AS_ARRAY as an
option.

Allow the option to occur in the options field by handling
"null" as default/use-options.
2017-03-17 15:36:24 -07:00
Sammy Kaye Powers
dac6c639bb Update copyright headers to 2017 2017-01-04 11:23:42 -06:00
Sammy Kaye Powers
478f119ab9 Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
Anatol Belski
25ee9465d1 add nmakefile fragment for json 2017-01-04 12:41:47 +01:00
Sammy Kaye Powers
9e29f841ce Update copyright headers to 2017 2017-01-02 09:30:12 -06:00
Sara Golemon
6007eb7584 Use new param API in json 2016-12-31 08:35:07 -08:00
Johannes Schlüter
54f526be89 Install ext/json headers 2016-12-07 17:50:05 +01:00
Anatol Belski
bfb9be9bd4 Merge branch 'PHP-7.1'
* PHP-7.1:
  remove TSRMLS_*
2016-11-22 00:33:29 +01:00
Anatol Belski
d61db8d602 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  remove TSRMLS_*
2016-11-22 00:32:42 +01:00
Anatol Belski
5e9b4c26a5 remove TSRMLS_* 2016-11-21 23:53:37 +01:00
Jakub Zelenka
563a341df7 Merge branch 'PHP-7.1' 2016-11-20 20:39:32 +00:00
Jakub Zelenka
f284479734 Merge branch 'PHP-7.0' into PHP-7.1 2016-11-20 20:38:34 +00:00
Jakub Zelenka
60574ea1ac Fix bug #73526 (php_json_encode depth issue) 2016-11-20 20:36:03 +00:00
Nikita Popov
8113daef49 json_encode(): Detect recursion earlier
json_encode() used a peculiar way of apply-count management,
whereby the apply-count was not incremented for the outermost
object/array, so that recursion was only detected after two
levels.
2016-11-19 23:52:08 +01:00
Jakub Zelenka
eff075ffaa Merge branch 'PHP-7.1' 2016-10-30 13:22:45 +00:00
Jakub Zelenka
c34de0b61c Introduce json encoder to fix globals related issues
It fixes bugs #66025 and #73254 by replacing globals with
a passed structure holding depth and error code. In addition
it fixes #72069 in a more generic way.
2016-10-30 13:20:10 +00:00
Dmitry Stogov
65ea250022 Merge branch 'PHP-7.1'
* PHP-7.1:
  Introduced HT_IS_PACKED() and HT_IS_WITHOUT_HOLES() macros. (Benjamin Coutu)
2016-10-19 23:12:17 +03:00
Dmitry Stogov
9ded1b4edb Introduced HT_IS_PACKED() and HT_IS_WITHOUT_HOLES() macros. (Benjamin Coutu) 2016-10-19 23:10:42 +03:00
Johannes Schlüter
b7fe687914 Install ext/json headers so that other extension can parse, too 2016-10-18 14:48:17 +02:00
Julien Pauli
7c7dc62c11 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Do not wrap user exception in case of custom JSON serialization

Conflicts:
	ext/json/json_encoder.c
2016-09-19 16:42:53 +02:00
Julien Pauli
c4f3ea10e4 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Do not wrap user exception in case of custom JSON serialization

Conflicts:
	ext/json/json.c
2016-09-19 16:11:17 +02:00