Moving json extension to core?
| From: | tyson andre | Date: | Wed, 22 Apr 2020 17:37:34 +0000 |
| Subject: | Moving json extension to core? | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-109783@lists.php.net to get a copy of this message | ||
Hi internals,
Currently, it's possible to disable the json extension with
./configure
--disable-json.
However, JSON is widely used in many use cases - web sites, logging output, and as a data format
that can be used in CLI programs
to share data with many applications and programming languages, so I'd personally find it
useful if it was always enabled.
(e.g. to publish self-contained scripts that don't require polyfills or less readable
var_export output)
https://wiki.php.net/rfc/jsond mentions that
> 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 Bug #63520. That results in not packaging json extension in the
> many Linux distributions.
Starting in php 7.0, I'd assume licensing is no longer an issue (correct me if I'm wrong).
I don't see anything discussed in the RFC or a quick search of email threads about making JSON
impossible to disable.
Doing this would also make some extensions more convenient to use (e.g. memcached with the json
serializer, using json encoding for uses such as error messages in miscellaneous extensions, etc.)
P.S. What are your thoughts about adding additional conversion specifiers such as %j or %v to PHP to
call JSON with the default options.
It's a feature similar to those I've seen in programming languages such as golang - https://golang.org/pkg/fmt/#hdr-Printing
- printf("console.log("value from php", %j);\n", $value)
- printf("Some command returned %j\n", $boolValue)
Thanks,
- Tyson