Commit graph

69 commits

Author SHA1 Message Date
Christoph M. Becker
18abfcb306
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Revert "Fix #79908: json_encode encodes negative zero as int"
2021-07-20 00:28:27 +02:00
Christoph M. Becker
2d2c001ca5
Revert "Fix #79908: json_encode encodes negative zero as int"
This reverts commit 717f1ed5e4.
2021-07-20 00:25:50 +02:00
Christoph M. Becker
1ba190bdb3
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #79908: json_encode encodes negative zero as int
2021-07-13 15:32:32 +02:00
Christoph M. Becker
717f1ed5e4
Fix #79908: json_encode encodes negative zero as int
Encoding a negative zero as `-0` is likely to loose the sign when
decoding (at least it does with `json_decode()`).  Therefore, we encode
it as if `JSON_PRESERVE_ZERO_FRACTION` was specified, i.e. as `-0.0`.

Closes GH-7234.
2021-07-13 15:31:07 +02:00
Nikita Popov
da0663a337 Add GC_TRY_ADDREF macro
That adds a ref if not immutable. Also audit uses of GC_IMMUTABLE
to either use GC_TRY_ADDREF or GC_TRY_PROTECT_RECURSION.
2020-09-15 11:41:09 +02:00
Gabriel Caruso
5d6e923d46
Remove mention of PHP major version in Copyright headers
Closes GH-4732.
2019-09-25 14:51:43 +02:00
Nikita Popov
eb7d57eb77 Merge branch 'PHP-7.3' into PHP-7.4 2019-04-23 12:43:37 +02:00
Nikita Popov
68892410f7 Merge branch 'PHP-7.2' into PHP-7.3 2019-04-23 12:43:32 +02:00
Nikita Popov
4831e150c5 Fixed bug #77843 2019-04-23 12:43:07 +02:00
Dmitry Stogov
46d5551fc3 Optimization for ASCII data 2019-03-18 19:33:51 +03:00
c9s
9f6f6fe219 Remove function_table var from the caller
function_table var is not used in call_user_function macro anymore
hence replace the usage with NULL
2019-03-11 10:00:39 +01:00
Peter Kokot
92ac598aab Remove local variables
This patch removes the so called local variables defined per
file basis for certain editors to properly show tab width, and
similar settings. These are mainly used by Vim and Emacs editors
yet with recent changes the once working definitions don't work
anymore in Vim without custom plugins or additional configuration.
Neither are these settings synced across the PHP code base.

A simpler and better approach is EditorConfig and fixing code
using some code style fixing tools in the future instead.

This patch also removes the so called modelines for Vim. Modelines
allow Vim editor specifically to set some editor configuration such as
syntax highlighting, indentation style and tab width to be set in the
first line or the last 5 lines per file basis. Since the php test
files have syntax highlighting already set in most editors properly and
EditorConfig takes care of the indentation settings, this patch removes
these as well for the Vim 6.0 and newer versions.

With the removal of local variables for certain editors such as
Emacs and Vim, the footer is also probably not needed anymore when
creating extensions using ext_skel.php script.

Additionally, Vim modelines for setting php syntax and some editor
settings has been removed from some *.phpt files.  All these are
mostly not relevant for phpt files neither work properly in the
middle of the file.
2019-02-03 21:03:00 +01:00
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
Xinchen Hui
7a7ec01a49 year++ 2018-01-02 12:55:14 +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