Upgrade/Install: Make version_compare() calls for plugin required version checks more robust.

Props afragen.
Fixes #46024. See #43986.


git-svn-id: https://develop.svn.wordpress.org/trunk@44656 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Felix Arntz 2019-01-20 12:02:02 +00:00
parent 6dde7cd74f
commit f518dea0bc
2 changed files with 6 additions and 6 deletions

View File

@ -504,9 +504,9 @@ class WP_Plugin_Install_List_Table extends WP_List_Table {
$wp_version = get_bloginfo( 'version' ); $wp_version = get_bloginfo( 'version' );
$compatible_php = ( empty( $plugin['requires_php'] ) || version_compare( substr( phpversion(), 0, strlen( $plugin['requires_php'] ) ), $plugin['requires_php'], '>=' ) ); $compatible_php = ( empty( $plugin['requires_php'] ) || version_compare( phpversion(), $plugin['requires_php'], '>=' ) );
$tested_wp = ( empty( $plugin['tested'] ) || version_compare( substr( $wp_version, 0, strlen( $plugin['tested'] ) ), $plugin['tested'], '<=' ) ); $tested_wp = ( empty( $plugin['tested'] ) || version_compare( $wp_version, $plugin['tested'], '<=' ) );
$compatible_wp = ( empty( $plugin['requires'] ) || version_compare( substr( $wp_version, 0, strlen( $plugin['requires'] ) ), $plugin['requires'], '>=' ) ); $compatible_wp = ( empty( $plugin['requires'] ) || version_compare( $wp_version, $plugin['requires'], '>=' ) );
$action_links = array(); $action_links = array();

View File

@ -756,9 +756,9 @@ function install_plugin_information() {
<?php <?php
$wp_version = get_bloginfo( 'version' ); $wp_version = get_bloginfo( 'version' );
$compatible_php = ( empty( $api->requires_php ) || version_compare( substr( phpversion(), 0, strlen( $api->requires_php ) ), $api->requires_php, '>=' ) ); $compatible_php = ( empty( $api->requires_php ) || version_compare( phpversion(), $api->requires_php, '>=' ) );
$tested_wp = ( empty( $api->tested ) || version_compare( substr( $wp_version, 0, strlen( $api->tested ) ), $api->tested, '<=' ) ); $tested_wp = ( empty( $api->tested ) || version_compare( $wp_version, $api->tested, '<=' ) );
$compatible_wp = ( empty( $api->requires ) || version_compare( substr( $wp_version, 0, strlen( $api->requires ) ), $api->requires, '>=' ) ); $compatible_wp = ( empty( $api->requires ) || version_compare( $wp_version, $api->requires, '>=' ) );
if ( ! $compatible_php ) { if ( ! $compatible_php ) {
echo '<div class="notice notice-error notice-alt"><p>'; echo '<div class="notice notice-error notice-alt"><p>';