From c6d3987b0831412f18ace8ea0f5c5423107a0d55 Mon Sep 17 00:00:00 2001 From: desrosj Date: Wed, 9 Oct 2019 22:22:04 +0000 Subject: [PATCH] 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 --- wp-admin/includes/update-core.php | 13 +++++++++++++ wp-includes/version.php | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/wp-admin/includes/update-core.php b/wp-admin/includes/update-core.php index 8df6150356..b2f7c7d711 100644 --- a/wp-admin/includes/update-core.php +++ b/wp-admin/includes/update-core.php @@ -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…' ) ); diff --git a/wp-includes/version.php b/wp-includes/version.php index fd57d12b71..e0d4c09220 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.