Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#33776 closed enhancement (maybelater)

Remove json_encode/json_decode and Services_JSON compat

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

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
11 years ago

  • Milestone Awaiting Review
  • Resolution → maybelater
  • Status new → 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
11 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
11 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.