rfc:free-json-parser
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:free-json-parser [2013/08/25 17:00] – [Proposal] remi | rfc:free-json-parser [2017/09/22 13:28] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== PHP RFC: Switch from json extension to jsonc ====== | ====== PHP RFC: Switch from json extension to jsonc ====== | ||
- | * Version: | + | * Version: 1.0 |
* Date: 2013-08-25 | * Date: 2013-08-25 | ||
* Author: Remi Collet < | * Author: Remi Collet < | ||
- | * Status: | + | * Status: Under Discussion |
* First Published at: https:// | * First Published at: https:// | ||
Line 15: | Line 15: | ||
Effectively, | Effectively, | ||
- | The encoder code is free since PHP 5.4.10 ([[https:// | + | The encoder code is free since PHP 5.4.10 ([[https:// |
===== Proposal ===== | ===== Proposal ===== | ||
- | The extension | + | The **jsonc** extension, currently available from PECL site is designed to be a dropin alternative |
- | * Same encoder | + | * Same **encoder** as in PHP 5.5 |
- | * Parser provided by the [[https:// | + | |
- | As the new parser | + | While the main purpose of this RFC is to fix the Licensing issue, it also introduce some new features. |
+ | As the new parser is an incremental one, the new **JsonIncrementalParser** class expose this feature | ||
< | < | ||
Line 41: | Line 42: | ||
$ret = $parser-> | $ret = $parser-> | ||
$result = $parser-> | $result = $parser-> | ||
+ | </ | ||
+ | |||
+ | The json-c parser provides 2 strictness mode: | ||
+ | * strict mode, used by default (for compatibility with previous implementation) | ||
+ | * standard mode, available using the JSON_PARSER_NOTSTRICT option | ||
+ | |||
+ | Having a **not-strict parser** could be usefull for reading configuration from manually edited file, such as: | ||
+ | < | ||
+ | /* | ||
+ | Foo configuration file | ||
+ | */ | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | } | ||
</ | </ | ||
Line 47: | Line 63: | ||
Partial implementation of big integers parsing (and of JSON_BIGINT_AS_STRING option). This will only work in a 32bits build for value fitting in a 64bits integer (not managed by PHP, so returned as string or float). Notice: no //natural// encoder will generate such data. | Partial implementation of big integers parsing (and of JSON_BIGINT_AS_STRING option). This will only work in a 32bits build for value fitting in a 64bits integer (not managed by PHP, so returned as string or float). Notice: no //natural// encoder will generate such data. | ||
- | As the new parser implement different error code, error is always | + | As the new parser implement different error codes, parser |
- | json_last_error_msg returns error string from the json-c library. | + | **json_last_error_msg()** returns error string from the json-c library. |
Line 60: | Line 76: | ||
* **Debian** since PHP 5.5 / Jessie | * **Debian** since PHP 5.5 / Jessie | ||
* **Fedora** since PHP 5.5 / Fedora 19 | * **Fedora** since PHP 5.5 / Fedora 19 | ||
- | * **Mageia** | + | * **Mageia** |
* **Ubuntu** since PHP 5.5 / Saucy | * **Ubuntu** since PHP 5.5 / Saucy | ||
Line 69: | Line 85: | ||
===== Impact to Existing Extensions ===== | ===== Impact to Existing Extensions ===== | ||
- | * replace json extension by jsonc | + | * replace json extension by jsonc (of course, renamed to json) |
===== New Constants ===== | ===== New Constants ===== | ||
Line 89: | Line 105: | ||
===== Unaffected PHP Functionality ===== | ===== Unaffected PHP Functionality ===== | ||
- | List existing areas/ | + | No change in PHP engine. |
- | + | No change for other extension. | |
- | This helps avoid any ambiguity, shows that you have thought deeply about the RFC's impact, and helps reduces mail list noise. | + | |
===== Future Scope ===== | ===== Future Scope ===== | ||
Line 97: | Line 112: | ||
Speed improvment. | Speed improvment. | ||
+ | As the original author (omar) seems no more involed, I could maintain this extension in the future. | ||
+ | Implement some RFE such as [[https:// | ||
===== Proposed Voting Choices ===== | ===== Proposed Voting Choices ===== | ||
rfc/free-json-parser.1377450033.txt.gz · Last modified: 2017/09/22 13:28 (external edit)