Re: Replacing ext/json and pecl/jsonc with pecl/jsond

From: Date: Sat, 12 Apr 2014 13:33:20 +0000
Subject: Re: Replacing ext/json and pecl/jsonc with pecl/jsond
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-73677@lists.php.net to get a copy of this message
On Sat, Apr 12, 2014 at 6:02 AM, Jan Tvrdík <jan.tvrdik@centrum.cz> wrote: > Hi, > > Is there a plan replace ext/json and pecl/jsonc with pecl/jsond? Using two > implementations is pain in the ass because they are NOT compatible with > each other and it is unlikely to change in the future. > > AFAIK the latest version of **ext/json** has at least the following > problems: > 1) license incompatible with evil > 2) causes fatal error for input {"\u0000": 1} > 3) does not handle surrogates properly, e.g. "\uD811\uD811" is accepted > and results in invalid UTF-8 > > Problems (2) a (3) are bugs (originally pointed out by Jakub Zelenka [1]) > and can be most likely fixed, however problem (1) can not be solved. > > AFAIK the latest version of **pecl/jsonc** has at least the following > problems: > 1) does not care about UTF-8 validity at all (https://github.com/ > remicollet/pecl-json-c/issues/9) > 2) does not support JSON_BIGINT_AS_STRING > a) 64bit version causes a warning "option JSON_BIGINT_AS_STRING not > implemented" > b) 32bit version does not support numbers larger than 9223372036854775807 > 3) does not support \u0000 in keys (https://github.com/ > remicollet/pecl-json-c/issues/7) > 4) does not support extended numbers syntax which is implemented in > ext/json [2] > > Unfortunately most of those problems are known for a while and there does > not seem to be the attitude to fix them. > > AFAIK the latest version of **pecl/jsond** has at least the following > problems: > 1) does not support extended numbers syntax which is implemented in > ext/json [2] > > However since we dropped in PHP 5.6 the extended literals syntax (e.g. > TRUE) we may consider dropping the extended numbers syntax (e.g 0xff) as > well to make it strictly follow the latest JSON RFC ( > http://tools.ietf.org/html/rfc7159, March 2014). > I've never encountered any of these issues so I have nothing more to say on them.* > I think that the best long-term solution is to replace ext/json with > pecl/jsond, preferably in PHP 5.6.0. > PHP 5.6 is in feature freeze. You'll have to shoot for PHP 5.7 or 6.0. > [1]: http://news.php.net/php.internals/73478 > [2]: > https://gist.github.com/JanTvrdik/10277952#file-test-php-L43-L60 > > > Thanks, > Jan Tvrdik > * As an aside I support the no evil clause. I realize I am in the vast minority here, but I wanted to say it.

« previous php.internals (#73677) next »