[RFC] Always available JSON extension

php.internals

tyson andre

6 years ago
Hi internals, I've created https://wiki.php.net/rfc/always_enable_json with an implementation at https://github.com/php/php-src/pull/5495 The proposal is to make it impossible to disable the JSON extension through configuration or build options, and require that JSON be built statically instead of as a shared library (to avoid linker errors or extension=json being commented out). > Currently, it's possible to disable the json extension with `./configure –disable-json`. > However, JSON is extremely useful to have because it's widely used for many use cases > (web sites, logging output, and as a data format that can be used to share data with > many applications and programming languages), > so it would be useful for PHP maintainers and users to guarantee that json is always enabled. Responses to earlier questions in my earlier thread "Moving json extension to core?" in https://externals.io/message/109783 > In terms of getting it passed, I'd focus on just the first part, making > JSON a "core" builtin. Let the printf modifier be a separate RFC, or at > least a separate question. Agreed - limiting this to making JSON a "core" builtin (similar to "hash" in 7.4) was my intent. The printf comment was to measure interest in a potential followup RFC that would depend on this (and give an example of internal functionality this would allow.). > At the risk of derailing... You can have your class implement the > interface unconditionally, then have a polyfill definition in your autoload > for cases where it doesn't exist. Obviously, it won't have an impact on > calls to json_encode(), but if the interface doesn't exist it's because > json_encode() doesn't either, so that should be harmless. :D That would work for userland, but might cause problems if multiple PECL modules were to take that approach, because they'd define duplicate classes. Thanks, - Tyson

tyson andre

6 years ago
Hi internals, I plan to start the vote for https://wiki.php.net/rfc/always_enable_json on May 13th > I've created https://wiki.php.net/rfc/always_enable_json with an implementation at https://github.com/php/php-src/pull/5495 > > The proposal is to make it impossible to disable the JSON extension through configuration or build options, > and require that JSON be built statically instead of as a shared library > (to avoid linker errors or extension=json being commented out). Discussion of this idea prior to creating this RFC can be seen at https://externals.io/message/109783 ("Moving json extension to core?") Thanks, - Tyson

Unnamed Person

6 years ago
Have we reached out to package maintainers for OS distributions that are not bundling json today to make sure all their concerns are resolved?

tyson andre

6 years ago
Hi Levi, > Have we reached out to package maintainers for OS distributions that are not bundling json today to make sure all their concerns are resolved? I CCed them on the GitHub PR just now. https://github.com/php/php-src/pull/5495#issuecomment-623163698 Hopefully, this is due to packaging conventions carrying over from php 5 and there are no remaining blockers. I didn't see this done for moving the hash extension into core, but I think most packagers were compiling it statically. - Tyson

tyson andre

6 years ago
Hi internals, One update before I start the vote for https://wiki.php.net/rfc/always_enable_json tomorrow (May 13th). - After feedback from extension authors and php contributors, the C define `HAVE_JSON` will not be removed as part of this RFC. I'll leave it to others to decide which php version it's appropriate to remove that constant in. > The proposal is to make it impossible to disable the JSON extension through configuration or build options, > and require that JSON be built statically instead of as a shared library > (to avoid linker errors or extension=json being commented out). > > Discussion of this idea prior to creating this RFC can be seen at > https://externals.io/message/109783 > > ("Moving json extension to core?") Thanks, - Tyson