rfc:jsond
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:jsond [2015/01/02 15:54] – bukka | rfc:jsond [2017/09/22 13:28] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== PHP RFC: Replacing current json extension with jsond ====== | ====== PHP RFC: Replacing current json extension with jsond ====== | ||
- | * Version: 0.1 | + | * Version: 0.2 |
* Date: 2015-01-01 | * Date: 2015-01-01 | ||
* Author: Jakub Zelenka, bukka@php.net | * Author: Jakub Zelenka, bukka@php.net | ||
- | * Status: | + | * Status: |
===== Introduction ===== | ===== Introduction ===== | ||
- | The Parser | + | The current Json Parser |
+ | |||
+ | The extension code is very old and without a maintainer | ||
===== Proposal ===== | ===== Proposal ===== | ||
- | The proposal is to replace current json extension with code based on the PECL jsond extension (it's not exactly the same as there are some modification | + | The proposal is to replace |
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== | ||
- | * Rejected ECMA-404 incompatible number formats | + | * Rejected ECMA-404 |
- | * top level (PHP json_decode check): | + | * top level (PHP json_decode check): 07, 0xff, .1, -.1 |
- | * all (JSON_Parser): | + | * all (JSON_Parser): |
+ | |||
+ | The first part (top level) is caused by different handling of integer and double because it's not handled by JSON_Parser. This is clearly a bug. | ||
+ | |||
+ | The second part is happening for all numbers. However it's not valid by the RFC 7159 as it says in https:// | ||
+ | |||
+ | < | ||
+ | number = [ minus ] int [ frac ] [ exp ] | ||
+ | decimal-point = %x2E ; | ||
+ | digit1-9 = %x31-39 | ||
+ | e = %x65 / %x45 ; e E | ||
+ | exp = e [ minus / plus ] 1*DIGIT | ||
+ | frac = decimal-point 1*DIGIT | ||
+ | int = zero / ( digit1-9 *DIGIT ) | ||
+ | minus = %x2D ; - | ||
+ | plus = %x2B ; + | ||
+ | zero = %x30 ; 0 | ||
+ | </ | ||
+ | |||
+ | Please note the definition of frac that specifies that at least one digit after decimal point is required. | ||
===== Proposed PHP Version(s) ===== | ===== Proposed PHP Version(s) ===== | ||
Line 25: | Line 46: | ||
==== To Existing Extensions ==== | ==== To Existing Extensions ==== | ||
- | * removed JSON_parser.h header | + | In addition to the backward incompatible changes for float number format the following internal changes have been done: |
- | * removed utf8_decode.h header | + | |
- | * error codes constants moved to php_json.h | + | * removed utf8_decode.h header |
- | * < | + | * macro JSON_PARSER_DEFAULT_DEPTH renamed to PHP_JSON_PARSER_DEFAULT_DEPTH |
- | * ext global | + | |
- | - macro JSON_PARSER_DEFAULT_DEPTH renamed to PHP_JSON_PARSER_DEFAULT_DEPTH | + | * enum error_codes renamed to php_json_error_codes (typedef) |
+ | * ext global error_code type changed from int to php_json_error_codes | ||
==== To Opcache ==== | ==== To Opcache ==== | ||
Line 36: | Line 58: | ||
==== New Constants ==== | ==== New Constants ==== | ||
- | New error < | + | None |
===== Open Issues ===== | ===== Open Issues ===== | ||
- | No | + | None |
- | + | ||
- | ===== Unaffected PHP Functionality ===== | + | |
- | There should be no changes from the User space except the one described above | + | |
===== Future Scope ===== | ===== Future Scope ===== | ||
- | Performance | + | * Improving performance |
+ | * Better error reporting (location of the error) | ||
- | ===== Proposed Voting Choices | + | ===== Vote ===== |
- | 50%+1 majority | + | 50%+1 majority. The vote is a straight Yes/No vote. |
+ | |||
+ | <doodle title=" | ||
+ | * Yes | ||
+ | * No | ||
+ | </ | ||
+ | |||
+ | The vote started on 2015-01-26 at 17:00 UTC and ended on 2015-02-01 at 17:00 UTC. | ||
===== Patches and Tests ===== | ===== Patches and Tests ===== | ||
- | https:// | + | Pull request for master branch: |
+ | |||
+ | The summary of the benchmarks is at https:// | ||
===== Implementation ===== | ===== Implementation ===== | ||
- | After the project is implemented, | + | After the project is implemented, |
- | - the version(s) it was merged to | + | - Merged |
- | - a link to the git commit(s) | + | |
- | - a link to the PHP manual entry for the feature | + | |
===== References ===== | ===== References ===== | ||
- | ... | + | There is an old RFC for [[https:// |
+ | |||
+ | Executed code showing the current non-conformant number parsing: http:// | ||
- | ===== Rejected Features ===== | ||
- | Keep this updated with features that were discussed on the mail lists. |
rfc/jsond.1420214088.txt.gz · Last modified: 2017/09/22 13:28 (external edit)