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.
Built from https://develop.svn.wordpress.org/trunk@46455


git-svn-id: http://core.svn.wordpress.org/trunk@46253 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
desrosj 2019-10-09 22:22:04 +00:00
parent 55560a708f
commit c6d3987b08
2 changed files with 14 additions and 1 deletions

View File

@ -1001,6 +1001,19 @@ function update_core( $from, $to ) {
);
}
// Add a warning when the JSON Extension is missing.
if ( ! extension_loaded( 'json' ) ) {
return new WP_Error(
'php_not_compatible',
sprintf(
/* translators: 1: WordPress version number, 2: The PHP Extension name needed. */
__( 'The update cannot be installed because WordPress %1$s requires the %2$s PHP Extension.' ),
$wp_version,
'JSON'
)
);
}
/** This filter is documented in wp-admin/includes/update-core.php */
apply_filters( 'update_feedback', __( 'Preparing to install the latest version…' ) );

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.3-beta3-46454';
$wp_version = '5.3-beta3-46455';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.