Make WordPress Core

Changeset 46455


Ignore:
Timestamp:
10/09/2019 10:20:37 PM (5 years ago)
Author:
desrosj
Message:

Upgrade/Install: Detect the presence of the native PHP JSON extension before updating.

The PHP native JSON extension has been bundled and compiled with PHP by default since version 5.2.0. Because the minimum version of PHP required by WordPress is now 5.6.20 (see #46594 and [45058]), the related polyfills and workarounds have been removed (see [46205-46206,46208]).

However, even though the JSON extension is now included in PHP by default, it is still possible to disable the extension in a custom configuration. This change will prevent sites from upgrading if the JSON extension is disabled to prevent compatibility issues.

Props jrf, jorbin, dd32, desrosj.
Fixes #47699.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/update-core.php

    r46400 r46455  
    10021002    }
    10031003
     1004    // Add a warning when the JSON Extension is missing.
     1005    if ( ! extension_loaded( 'json' ) ) {
     1006        return new WP_Error(
     1007            'php_not_compatible',
     1008            sprintf(
     1009                /* translators: 1: WordPress version number, 2: The PHP Extension name needed. */
     1010                __( 'The update cannot be installed because WordPress %1$s requires the %2$s PHP Extension.' ),
     1011                $wp_version,
     1012                'JSON'
     1013            )
     1014        );
     1015    }
     1016
    10041017    /** This filter is documented in wp-admin/includes/update-core.php */
    10051018    apply_filters( 'update_feedback', __( 'Preparing to install the latest version…' ) );
Note: See TracChangeset for help on using the changeset viewer.