rfc:json_validate
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:json_validate [2022/09/21 21:37] – juan_morales | rfc:json_validate [2022/10/08 14:51] (current) – Implemented. timwolla | ||
---|---|---|---|
Line 3: | Line 3: | ||
* Date: 2022-08-14 | * Date: 2022-08-14 | ||
* Author: Juan Carlos Morales, dev.juan.morales@gmail.com | * Author: Juan Carlos Morales, dev.juan.morales@gmail.com | ||
- | * Status: | + | * Status: |
+ | * Target Version: PHP 8.3 | ||
* First Published at: http:// | * First Published at: http:// | ||
* Implementation: | * Implementation: | ||
Line 11: | Line 12: | ||
Most userland implementations use json_decode() which by design generates a ZVAL(object/ | Most userland implementations use json_decode() which by design generates a ZVAL(object/ | ||
+ | |||
+ | The proposed function will use the exact same JSON parser that already exists in the PHP core, which is also use by json_decode(), | ||
===== Proposal ===== | ===== Proposal ===== | ||
Line 119: | Line 122: | ||
==== Complexity added in the core ==== | ==== Complexity added in the core ==== | ||
- | At the moment, there is a JSON parser in the core, used by json_decode to do its job, so there is no need to write a new JSON parser for this RFC; the proposed function will use the existing JSON parser exclusively to parse an string without generating any object/ | + | At the moment, there is a JSON parser in the core, used by //json_decode()// to do its job, so there is no need to write a new JSON parser for this RFC; the proposed function will use the existing JSON parser exclusively to parse an string without generating any object/ |
===== Reasons NOT to have json_validate() function in the core ===== | ===== Reasons NOT to have json_validate() function in the core ===== | ||
Line 152: | Line 155: | ||
The ability to throw an exception on error was removed from the implementation, | The ability to throw an exception on error was removed from the implementation, | ||
- | I also hae to admit that after they showed their arguments, I changed my mind, and now I also think it makes sense to have such a behavior in the function. | + | I also have to admit that after they showed their arguments, I changed my mind, and now I also think it makes sense to have such a behavior in the function. |
So removing the ability to throw exception on error was removed from implementation. | So removing the ability to throw exception on error was removed from implementation. | ||
==== Others ==== | ==== Others ==== | ||
- | * I removed 3 of the provided examples because did not adjust to the RFC purpose or were not clear. | + | * I removed 3 of the originally |
- | * Had to adjust the wording regarding disadvantage of using json_decode() as pointed here: | + | * I had to adjust the wording |
* [[https:// | * [[https:// | ||
Line 364: | Line 367: | ||
Someone has also doing exactly this , in JAVA. [[https:// | Someone has also doing exactly this , in JAVA. [[https:// | ||
+ | ===== Vote ===== | ||
+ | |||
+ | Voting started 2022-09-22 and will end on 2022-10-07 at 00:00:00 UTC time zone. | ||
+ | |||
+ | <doodle title=" | ||
+ | * Yes | ||
+ | * No | ||
+ | </ |
rfc/json_validate.1663796236.txt.gz · Last modified: 2022/09/21 21:37 by juan_morales