rfc:jsond

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:jsond [2015/01/11 18:30] bukkarfc: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: Under Discussion+  * Status: Implemented (PHP 7.0)
  
  
 ===== Introduction ===== ===== Introduction =====
-The current Json Parser in the json extension does not have a free license which is a problem for many Linux distros. This has been referenced at [[https://bugs.php.net/63520|Bug #63520]].+The current Json Parser in the json extension does not have a free license which is a problem for many Linux distros. This has been referenced at [[https://bugs.php.net/63520|Bug #63520]]. That results in not packaging json extension in the many Linux distributions.
  
 The extension code is very old and without a maintainer which makes it difficult for further improvements. There also are some implementation decisions that makes the performance worse than it should be (see benchmarks). The extension code is very old and without a maintainer which makes it difficult for further improvements. There also are some implementation decisions that makes the performance worse than it should be (see benchmarks).
Line 18: Line 18:
     * top level (PHP json_decode check): 07, 0xff, .1, -.1     * top level (PHP json_decode check): 07, 0xff, .1, -.1
     * all (JSON_Parser): [1.], [1.e1]     * all (JSON_Parser): [1.], [1.e1]
 +
 +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://tools.ietf.org/html/rfc7159#section-6 :
 +
 +<code>
 +number = [ minus ] int [ frac ] [ exp ]
 +decimal-point = %x2E       ; .
 +digit1-9 = %x31-39         ; 1-9
 +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
 +</code>
 +
 +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 48: Line 67:
   * Better error reporting (location of the error)   * 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="Should jsond based extension replace the current json extension in PHP 7?" auth="bukka" voteType="single" closed="true"> 
 +   * Yes 
 +   * No 
 +</doodle> 
 + 
 +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 =====
-The current patch for master can be seen at https://github.com/bukka/php-src/compare/jsond+Pull request for master branch: https://github.com/php/php-src/pull/993
  
 The summary of the benchmarks is at https://github.com/bukka/php-jsond-bench/blob/master/reports/0001/summary.md. There also is a link for runs (measured data). The summary of the benchmarks is at https://github.com/bukka/php-jsond-bench/blob/master/reports/0001/summary.md. There also is a link for runs (measured data).
Line 58: Line 84:
 ===== Implementation ===== ===== Implementation =====
 After the project is implemented, this section will contain  After the project is implemented, this section will contain 
-  - the version(s) it was merged to +  - Merged to the master branch and will be released in PHP 7
-  - a link to the git commit(s)+
  
 ===== References ===== ===== References =====
 There is an old RFC for [[https://wiki.php.net/rfc/free-json-parser|free json parser]] that proposed jsonc as a replacement for json. There were some concerns about the compatibility and performance https://www.mail-archive.com/internals@lists.php.net/msg66658.html . There is an old RFC for [[https://wiki.php.net/rfc/free-json-parser|free json parser]] that proposed jsonc as a replacement for json. There were some concerns about the compatibility and performance https://www.mail-archive.com/internals@lists.php.net/msg66658.html .
 +
 +Executed code showing the current non-conformant number parsing: http://3v4l.org/2D72Q
  
rfc/jsond.1421001014.txt.gz · Last modified: 2017/09/22 13:28 (external edit)