WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#33776 closed enhancement (maybelater)

Remove json_encode/json_decode and Services_JSON compat

Reported by: Rahe Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.4
Component: External Libraries Keywords:
Focuses: Cc:

Description

Hi,

since PHP 5.2 is the minimum version and json extension is bundled and compiled by default (http://php.net/manual/en/json.installation.php) maybe we should considering to remove this compat from the core.

It has been restored 4 years ago (https://core.trac.wordpress.org/ticket/18015) but since the minimal version is 5.2 so this can be done IMHO.

Change History (3)

#1 @dd32
6 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to maybelater
  • Status changed from new to closed

Unfortunately the extension can be disabled via the --disable-all and I believe --disable-json in older versions of PHP. Until we bump the minimum requirement to (IIRC, PHP 5.3) we need to keep the compat library around.

#2 @Rahe
6 years ago

So I cannot disable it in 5.3 compilation ?
Because it's says it's part of the PHP core now.
http://php.net/manual/en/json.requirements.php

Thank you for responding.

#3 @dd32
6 years ago

You do not need to do anything special. The compat library is only included if your PHP doesn't have native support for the JSON extension.

For maximum compatibility, you should always use wp_json_encode() however to work around PHP bugs and shortcomings.

Note: See TracTickets for help on using tickets.