rfc:json_validate

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
rfc:json_validate [2022/09/21 21:53] juan_moralesrfc: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: Under Discussion+  * Status: Implemented 
 +  * Target Version: PHP 8.3
   * First Published at: http://wiki.php.net/rfc/json_validate   * First Published at: http://wiki.php.net/rfc/json_validate
   * Implementation: https://github.com/php/php-src/pull/9399   * Implementation: https://github.com/php/php-src/pull/9399
Line 121: 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/array/etc. in memory for it.+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/array/etc. in memory for it.
  
 ===== Reasons NOT to have json_validate() function in the core ===== ===== Reasons NOT to have json_validate() function in the core =====
Line 154: Line 155:
 The ability to throw an exception on error was removed from the implementation, as this was pointed not only by most of user in the mailing list (with good reasons), but also during code review; as it does not make sense to have such a behavior. The ability to throw an exception on error was removed from the implementation, as this was pointed not only by most of user in the mailing list (with good reasons), but also during code review; as it does not make sense to have such a behavior.
  
-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 provided examples in the RFC because did not adjust to the RFC purpose or were not clear. 
-  * Had to adjust the wording regarding disadvantage of using json_decode() as pointed here:+  * I had to adjust the wording in this RFC document regarding disadvantage of using json_decode() as pointed here:
     * [[https://github.com/php/php-src/pull/9399#discussion_r955626844|PR comment from user drealecs]]     * [[https://github.com/php/php-src/pull/9399#discussion_r955626844|PR comment from user drealecs]]
  
Line 366: Line 367:
 Someone has also doing exactly this , in JAVA. [[https://stackoverflow.com/questions/3679479/check-if-file-is-json-java|In Java]] Someone has also doing exactly this , in JAVA. [[https://stackoverflow.com/questions/3679479/check-if-file-is-json-java|In Java]]
  
 +===== Vote =====
 +
 +Voting started 2022-09-22 and will end on 2022-10-07 at 00:00:00 UTC time zone.
 +
 +<doodle title="json_validate" auth="juan_morales" voteType="single" closed="true" closeon="2022-10-07T00:00:00Z">
 +   * Yes
 +   * No
 +</doodle>
rfc/json_validate.1663797239.txt.gz · Last modified: 2022/09/21 21:53 by juan_morales