-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explicitly require the hash
extension.
#8138
base: trunk
Are you sure you want to change the base?
Changes from all commits
6e66fd2
f2ff4a4
9777cec
4640972
55f02be
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1009,9 +1009,6 @@ | |
* @global array $_old_requests_files | ||
* @global array $_new_bundled_files | ||
* @global wpdb $wpdb WordPress database abstraction object. | ||
* @global string $wp_version | ||
* @global string $required_php_version | ||
* @global string $required_mysql_version | ||
* | ||
* @param string $from New release unzipped path. | ||
* @param string $to Path to old WordPress installation. | ||
|
@@ -1075,7 +1072,7 @@ function update_core( $from, $to ) { | |
} | ||
|
||
/* | ||
* Import $wp_version, $required_php_version, and $required_mysql_version from the new version. | ||
* Import $wp_version, $required_php_version, $required_php_extensions, and $required_mysql_version from the new version. | ||
* DO NOT globalize any variables imported from `version-current.php` in this function. | ||
* | ||
* BC Note: $wp_filesystem->wp_content_dir() returned unslashed pre-2.8. | ||
|
@@ -1181,17 +1178,25 @@ function update_core( $from, $to ) { | |
); | ||
} | ||
|
||
// Add a warning when the JSON PHP extension is missing. | ||
if ( ! extension_loaded( 'json' ) ) { | ||
return new WP_Error( | ||
'php_not_compatible_json', | ||
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' | ||
) | ||
); | ||
$missing_extensions = new WP_Error(); | ||
|
||
foreach ( $required_php_extensions as $extension ) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it worth doing an It's probably worht checking when the failed upgrade is caught. |
||
if ( ! extension_loaded( $extension ) ) { | ||
$missing_extensions->add( | ||
"php_not_compatible_{$extension}", | ||
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, | ||
$extension | ||
) | ||
); | ||
} | ||
} | ||
|
||
// Add a warning when required PHP extensions are missing. | ||
if ( $missing_extensions->has_errors() ) { | ||
return $missing_extensions; | ||
} | ||
|
||
/** This filter is documented in wp-admin/includes/update-core.php */ | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -36,12 +36,13 @@ | |||||
} | ||||||
|
||||||
/** | ||||||
* @global string $wp_version The WordPress version string. | ||||||
* @global string $required_php_version The required PHP version string. | ||||||
* @global string $required_mysql_version The required MySQL version string. | ||||||
* @global wpdb $wpdb WordPress database abstraction object. | ||||||
* @global string $wp_version The WordPress version string. | ||||||
* @global string $required_php_version The required PHP version string. | ||||||
* @global string[] $required_php_extensions The names of required PHP extensions. | ||||||
* @global string $required_mysql_version The required MySQL version string. | ||||||
* @global wpdb $wpdb WordPress database abstraction object. | ||||||
*/ | ||||||
global $wp_version, $required_php_version, $required_mysql_version, $wpdb; | ||||||
global $wp_version, $required_php_version, $required_php_extensions, $required_mysql_version, $wpdb; | ||||||
|
||||||
$step = (int) $step; | ||||||
|
||||||
|
@@ -54,6 +55,20 @@ | |||||
$mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' ); | ||||||
} | ||||||
|
||||||
$missing_extensions = array(); | ||||||
|
||||||
foreach ( $required_php_extensions as $extension ) { | ||||||
if ( ! extension_loaded( $extension ) ) { | ||||||
$missing_extensions[] = sprintf( | ||||||
/* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: The PHP extension name needed. */ | ||||||
__( 'You cannot install because <a href="%1$s">WordPress %2$s</a> requires the %3$s PHP extension.' ), | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I tested this by bumping the db version in |
||||||
$version_url, | ||||||
$wp_version, | ||||||
$extension | ||||||
); | ||||||
} | ||||||
} | ||||||
|
||||||
header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) ); | ||||||
?> | ||||||
<!DOCTYPE html> | ||||||
|
@@ -126,8 +141,8 @@ | |||||
} | ||||||
|
||||||
echo '<p>' . $message . '</p>'; | ||||||
?> | ||||||
<?php | ||||||
elseif ( count( $missing_extensions ) > 0 ) : | ||||||
echo '<p>' . implode( '</p><p>', $missing_extensions ) . '</p>'; | ||||||
else : | ||||||
switch ( $step ) : | ||||||
case 0: | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unable to test this file/code path as it takes the required versions from the new version file.