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
Juan Basso
95cef47afb
Porting implementation of RFC json_preserve_fractional_part
2015-01-12 21:29:52 -05:00
Jakub Zelenka
e6fb493e5d
Refactore json double encoding to use php_gcvt
2015-01-11 13:30:21 +00:00
Jakub Zelenka
8304e468cd
Replace encoder functions json prefix with php_json
2015-01-10 19:13:28 +00:00
Jakub Zelenka
b68da91d52
Merge branch 'master' into jsond
...
Conflicts:
ext/json/JSON_parser.c
ext/json/JSON_parser.h
ext/json/config.m4
ext/json/config.w32
ext/json/json.c
ext/json/php_json.h
2014-12-27 19:42:04 +00:00
Jakub Zelenka
f18aae6042
Fix compilation for json_encoder
2014-11-30 17:47:17 +00:00
Jakub Zelenka
e18dd67975
Move json encoding stuff
2014-11-24 20:46:13 +00:00