rfc:jsond

This is an old revision of the document!


PHP RFC: Replacing current json extension with jsond

  • Version: 0.1
  • Date: 2015-01-01
  • Author: Jakub Zelenka, bukka@php.net
  • Status: Draft

Introduction

The Parser for the current json extension does not have a free license which is a problem for many Linux distros. The extension code is also very old which makes it difficult for further improvements. There also are some implementation decisions that makes the performance worse than it should be

Proposal

The proposal is to replace current json extension with code that is based on the PECL jsond extension (it's not exactly the same code as there are some modification for PHP 7).

Backward Incompatible Changes

  • Rejected ECMA-404 incompatible number formats
    • top level (PHP json_decode check): 07, 0xff, .1, -.1
    • all (JSON_Parser): [1.], [1.e1]

Proposed PHP Version(s)

PHP 7

RFC Impact

To SAPIs

No impact

To Existing Extensions

* removed JSON_parser.h header * removed utf8_decode.h header * error codes constants moved to php_json.h

  • enum error_codes renamed to php_json_error_codes (typedef)
  • ext global error_code type changed from int to php_json_error_codes

- macro JSON_PARSER_DEFAULT_DEPTH renamed to PHP_JSON_PARSER_DEFAULT_DEPTH

To Opcache

No impact

New Constants

New error JSON_ERROR_UTF16 for invalid \uXXXX code (ill-formed surrogate pairs)

Open Issues

The error JSON_ERROR_UTF16 is incompatible with the spec and should be probably removed

Unaffected PHP Functionality

There should be no changes from the User space except the one described above

Future Scope

* Performance for encoder * Better error reporting (location of the error)

Proposed Voting Choices

50%+1 majority

Patches and Tests

The current patch for master can be seen at https://github.com/bukka/php-src/compare/jsond

Benchmarks are in progress

Implementation

After the project is implemented, this section should contain

  1. the version(s) it was merged to
  2. a link to the git commit(s)
  3. a link to the PHP manual entry for the feature

References

...

Rejected Features

Keep this updated with features that were discussed on the mail lists.

rfc/jsond.1420308947.txt.gz · Last modified: 2017/09/22 13:28 (external edit)