summaryrefslogtreecommitdiff
path: root/ext/json/json_encoder.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix json_encode regression with JSON_PRETTY_PRINTTyson Andre2021-03-271-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | This makes the json encoding behavior the same as it was prior to the memory optimizations added in f9f8c1c79cac1b03279190e0c5513a51881615f9 (for objects with declared properties) This is based on the code for the unoptimized case below the changes. Buggy output prior to this commit: ``` { "prop":"value"} ``` Correct output: ``` { "prop": "value" } ``` Closes GH-6811
* Implement enumsIlija Tovilo2021-03-171-0/+17
| | | | | | | | RFC: https://wiki.php.net/rfc/enumerations Co-authored-by: Nikita Popov <nikita.ppv@gmail.com> Closes GH-6489.
* Optimized object encoding without rebulding properties HashTableDmitry Stogov2021-03-011-0/+61
|
* Add array_is_list(array $array) functionDusk2021-01-201-22/+3
| | | | | | | | | | | | | | | | | | | | This function tests if an array contains only sequential integer keys. While list isn't an official type, this usage is consistent with the community usage of "list" as an annotation type, cf. https://psalm.dev/docs/annotating_code/type_syntax/array_types/#lists Rebased and modified version of #4886 - Use .stub.php files - Add opcache constant evaluation when argument is a constant - Change from is_list(mixed $value) to array_is_list(array $array) RFC: https://wiki.php.net/rfc/is_list Co-Authored-By: Tyson Andre <tysonandre775@hotmail.com> Co-Authored-By: Dusk <dusk@woofle.net> Closes GH-6070
* Add GC_TRY_ADDREF macroNikita Popov2020-09-151-4/+4
| | | | | That adds a ref if not immutable. Also audit uses of GC_IMMUTABLE to either use GC_TRY_ADDREF or GC_TRY_PROTECT_RECURSION.
* Remove mention of PHP major version in Copyright headersGabriel Caruso2019-09-251-2/+0
| | | | Closes GH-4732.
* Merge branch 'PHP-7.3' into PHP-7.4Nikita Popov2019-04-231-2/+10
|\
| * Merge branch 'PHP-7.2' into PHP-7.3Nikita Popov2019-04-231-2/+10
| |\
| | * Fixed bug #77843Nikita Popov2019-04-231-2/+10
| | |
| | * year++Xinchen Hui2018-01-021-1/+1
| | |
* | | Optimization for ASCII dataDmitry Stogov2019-03-181-73/+68
| | |
* | | Remove function_table var from the callerc9s2019-03-111-1/+1
| | | | | | | | | | | | | | | function_table var is not used in call_user_function macro anymore hence replace the usage with NULL
* | | Remove local variablesPeter Kokot2019-02-031-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Remove yearly range from copyright noticeZeev Suraski2019-01-301-1/+1
| | |
* | | Introduce get_properties_for() handlerNikita Popov2018-10-101-2/+7
|/ / | | | | | | | | This handler allows getting the object properties for a particular purpose, such as array casting, serialization, etc.
* | php_json_escape_string() optimizationDmitry Stogov2018-06-131-35/+60
| |
* | Removed useless zval_ptr_dtor()Dmitry Stogov2018-05-291-1/+1
| |
* | Bit test optimizationDmitry Stogov2018-05-081-1/+1
| |
* | Bit check micro-optimizationDmitry Stogov2018-04-281-1/+1
| |
* | year++Xinchen Hui2018-01-021-1/+1
| |
* | Merge branch 'PHP-7.2'Jakub Zelenka2017-10-151-2/+7
|\ \ | |/
| * Fix bug #68567 (JSON_PARTIAL_OUTPUT_ON_ERROR can result in JSON with null key)Jakub Zelenka2017-10-151-2/+7
| |
* | Refactored recursion pretectionDmitry Stogov2017-10-061-16/+16
|/
* [ci skip] Remove CSV leftovers from json code - $Id$Jakub Zelenka2017-07-161-2/+0
|
* Add JSON_INVALID_UTF8_SUBSTITUTE and JSON_INVALID_UTF8_IGNOREJakub Zelenka2017-07-161-8/+22
| | | | | It implements request #65082 and adds options for replacing resp. ignoring invalid UTF-8 sequences for json_encode and json_decode.
* Optimization for fast path.Dmitry Stogov2017-06-191-80/+83
|
* Fixed performance degradaton introduced in f6ac96bDmitry Stogov2017-06-131-17/+23
|
* Improve and simplify UTF-8 validation in JSONJakub Zelenka2017-06-111-50/+16
|
* Improved UTF-8 validation in JSONDmitry Stogov2017-05-251-27/+10
|
* Update copyright headers to 2017Sammy Kaye Powers2017-01-021-1/+1
|
* json_encode(): Detect recursion earlierNikita Popov2016-11-191-20/+15
| | | | | | | 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.
* Introduce json encoder to fix globals related issuesJakub Zelenka2016-10-301-32/+37
| | | | | | 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.
* Introduced HT_IS_PACKED() and HT_IS_WITHOUT_HOLES() macros. (Benjamin Coutu)Dmitry Stogov2016-10-191-0/+4
|
* Merge branch 'PHP-7.0' into PHP-7.1Julien Pauli2016-09-191-1/+3
|\ | | | | | | | | | | | | | | * PHP-7.0: Do not wrap user exception in case of custom JSON serialization Conflicts: ext/json/json_encoder.c
| * Merge branch 'PHP-5.6' into PHP-7.0Julien Pauli2016-09-191-1/+3
| | | | | | | | | | | | | | | | * PHP-5.6: Do not wrap user exception in case of custom JSON serialization Conflicts: ext/json/json.c
* | Fix recursion and protection in the failed JSON encodingJakub Zelenka2016-08-291-11/+20
| |
* | Add initial failure checking for json_encodeJakub Zelenka2016-08-291-38/+54
| |
* | Use one place to define max length of doubleJakub Zelenka2016-06-261-10/+2
| | | | | | | | Introduce new constant PHP_DOUBLE_MAX_LENGTH for that purpose
* | Replace json.precision with serialize_precisionJakub Zelenka2016-06-261-1/+1
| |
* | Add castYasuo Ohgaki2016-06-261-1/+1
| |
* | Simply use ndigit for flag for zend_dtoa modeYasuo Ohgaki2016-06-261-5/+2
| |
* | Add JSON_G(precision)Yasuo Ohgaki2016-06-261-2/+2
| |
* | Initial patch for 0 mode float conversion. The magic number is better to be ↵Yasuo Ohgaki2016-06-261-1/+5
| | | | | | | | improved. Any suggestion where to define it?
* | Use empty keys instead of _empty_ in json decodingJakub Zelenka2016-06-201-1/+1
| |
* | Merge branch 'PHP-7.0'Xinchen Hui2016-05-061-45/+38
|\ \ | |/ | | | | | | * PHP-7.0: Revert "Fixed bug #72170 (JsonSerializable may inc apply count without dec it)"
| * Revert "Fixed bug #72170 (JsonSerializable may inc apply count without dec it)"Xinchen Hui2016-05-061-45/+38
| | | | | | | | This reverts commit 459a7cc209da130256d66c1f896199540f4dadbc.
* | Merge branch 'PHP-7.0'Xinchen Hui2016-05-061-38/+45
|\ \ | |/ | | | | | | * PHP-7.0: Fixed bug #72170 (JsonSerializable may inc apply count without dec it)
| * Fixed bug #72170 (JsonSerializable may inc apply count without dec it)Xinchen Hui2016-05-061-38/+45
| | | | | | | | I don't want use zend_try here, but seems I have no choice :<
* | Merge branch 'PHP-7.0'Xinchen Hui2016-04-221-0/+4
|\ \ | |/
| * Fixed bug #72069 (Behavior \JsonSerializable different from json_encode)Xinchen Hui2016-04-221-0/+4
| |