Commit graph

56 commits

Author SHA1 Message Date
Zeev Suraski
0cf7de1c70 Remove yearly range from copyright notice 2019-01-30 11:03:12 +02:00
Nikita Popov
7ec8087f80 Introduce get_properties_for() handler
This handler allows getting the object properties for a particular
purpose, such as array casting, serialization, etc.
2018-10-10 10:39:10 +02:00
Dmitry Stogov
c1ce43d1d2 php_json_escape_string() optimization 2018-06-13 18:26:48 +03:00
Dmitry Stogov
d90c6f2443 Removed useless zval_ptr_dtor() 2018-05-29 17:58:06 +03:00
Dmitry Stogov
4ad9cf4605 Bit test optimization 2018-05-08 11:58:17 +03:00
Dmitry Stogov
c88be6aee1 Bit check micro-optimization 2018-04-28 14:13:12 +03:00
Xinchen Hui
a6519d0514 year++ 2018-01-02 12:57:58 +08:00
Jakub Zelenka
d1f5811ff0 Merge branch 'PHP-7.2' 2017-10-15 19:37:22 +01: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
Dmitry Stogov
cb9d81ef4f Refactored recursion pretection 2017-10-06 01:34:50 +03:00
Jakub Zelenka
0f047f60f0 [ci skip] Remove CSV leftovers from json code - $Id$ 2017-07-16 15:51:39 +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
6fe75aad6d Optimization for fast path. 2017-06-19 10:07:11 +03: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
Sammy Kaye Powers
9e29f841ce Update copyright headers to 2017 2017-01-02 09:30:12 -06: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
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
9ded1b4edb Introduced HT_IS_PACKED() and HT_IS_WITHOUT_HOLES() macros. (Benjamin Coutu) 2016-10-19 23:10:42 +03: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
Jakub Zelenka
df05dbb3df Fix recursion and protection in the failed JSON encoding 2016-08-29 14:49:40 +01:00
Jakub Zelenka
12a8c3f6e7 Add initial failure checking for json_encode 2016-08-29 14:49:40 +01:00
Jakub Zelenka
3f13507dd2 Use one place to define max length of double
Introduce new constant PHP_DOUBLE_MAX_LENGTH for that purpose
2016-06-26 14:03:01 +01:00
Jakub Zelenka
75b86a2c22 Replace json.precision with serialize_precision 2016-06-26 13:26:43 +01:00
Yasuo Ohgaki
5f5dc04fc2 Add cast 2016-06-26 13:26:43 +01:00
Yasuo Ohgaki
e3d9f1f4d8 Simply use ndigit for flag for zend_dtoa mode 2016-06-26 13:26:43 +01:00
Yasuo Ohgaki
3aa2aadcf0 Add JSON_G(precision) 2016-06-26 13:26:43 +01:00
Yasuo Ohgaki
f943daf2d7 Initial patch for 0 mode float conversion. The magic number is better to be improved. Any suggestion where to define it? 2016-06-26 13:26:42 +01:00
Jakub Zelenka
f0d1cca672 Use empty keys instead of _empty_ in json decoding 2016-06-20 19:44:00 +01:00
Xinchen Hui
ed0eb2bfdd Merge branch 'PHP-7.0'
* PHP-7.0:
  Revert "Fixed bug #72170 (JsonSerializable may inc apply count without dec it)"
2016-05-06 20:25:43 +08:00
Xinchen Hui
197470b62f Revert "Fixed bug #72170 (JsonSerializable may inc apply count without dec it)"
This reverts commit 459a7cc209.
2016-05-06 20:25:24 +08:00
Xinchen Hui
10f8ca9151 Merge branch 'PHP-7.0'
* PHP-7.0:
  Fixed bug #72170 (JsonSerializable may inc apply count without dec it)
2016-05-06 18:39:18 +08:00
Xinchen Hui
459a7cc209 Fixed bug #72170 (JsonSerializable may inc apply count without dec it)
I don't want use zend_try here, but seems I have no choice :<
2016-05-06 18:38:26 +08:00
Xinchen Hui
fa5f28a0a1 Merge branch 'PHP-7.0' 2016-04-22 21:41:52 -07:00
Xinchen Hui
589d0e0f18 Fixed bug #72069 (Behavior \JsonSerializable different from json_encode) 2016-04-22 21:41:44 -07:00
Eddie Kohler
104876dd8e 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.
2016-01-22 19:40:58 +00:00
Lior Kaplan
2eb1f38d24 Happy new year (Update copyright to 2016) 2016-01-01 20:03:16 +02:00
Dmitry Stogov
4a2e40bb86 Use ZSTR_ API to access zend_string elements (this is just renaming without semantick changes). 2015-06-30 04:05:24 +03:00
Xinchen Hui
9f0dbdf6c8 Use Z_ARRVAL_P since we already know it's an array 2015-05-06 11:10:33 +08:00
Anatol Belski
fe36285de2 fix datatype mismatches 2015-03-25 15:32:35 +01:00
Dmitry Stogov
d68861eb4b Improved php_json_escape_string() 2015-03-11 15:03:07 +03:00
Jakub Zelenka
ad2b751985 Merge branch 'PHP-5.6'
The fix for master is a bit different (it's fixed in encoder)
2015-02-22 20:54:05 +00:00
Michael Wallner
09a3e7377a fix json globals 2015-02-09 17:57:18 +01:00
Anatol Belski
fc5b349789 size_t vs int 2015-02-09 10:47:39 +01:00
Jakub Zelenka
f2825042b4 Merge branch 'master' into jsond
Conflicts:
	ext/json/json.c
2015-02-08 14:08:31 +00:00
Jakub Zelenka
20bae2a503 Give me credit 2015-02-02 19:33:48 +00:00
Jakub Zelenka
3159d518d0 Merge branch 'master' into jsond
Conflicts:
	ext/json/JSON_parser.c
	ext/json/json.c
2015-01-25 18:43:15 +00:00
Jakub Zelenka
3ddb5993dd Increase PHP_JSON_DOUBLE_MAX_LENGTH for fractional part
This is probably not necessary as such number
is not realistic. It's just to be consistent
with jsond extension.
2015-01-18 16:31:24 +00:00