From f518dea0bcb8a27e0b7bb914dd0e9e01d632c66f Mon Sep 17 00:00:00 2001 From: Felix Arntz Date: Sun, 20 Jan 2019 12:02:02 +0000 Subject: [PATCH] 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 --- .../includes/class-wp-plugin-install-list-table.php | 6 +++--- src/wp-admin/includes/plugin-install.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/wp-admin/includes/class-wp-plugin-install-list-table.php b/src/wp-admin/includes/class-wp-plugin-install-list-table.php index 03c7e81c47..3ff7991fc5 100644 --- a/src/wp-admin/includes/class-wp-plugin-install-list-table.php +++ b/src/wp-admin/includes/class-wp-plugin-install-list-table.php @@ -504,9 +504,9 @@ class WP_Plugin_Install_List_Table extends WP_List_Table { $wp_version = get_bloginfo( 'version' ); - $compatible_php = ( empty( $plugin['requires_php'] ) || version_compare( substr( phpversion(), 0, strlen( $plugin['requires_php'] ) ), $plugin['requires_php'], '>=' ) ); - $tested_wp = ( empty( $plugin['tested'] ) || version_compare( substr( $wp_version, 0, strlen( $plugin['tested'] ) ), $plugin['tested'], '<=' ) ); - $compatible_wp = ( empty( $plugin['requires'] ) || version_compare( substr( $wp_version, 0, strlen( $plugin['requires'] ) ), $plugin['requires'], '>=' ) ); + $compatible_php = ( empty( $plugin['requires_php'] ) || version_compare( phpversion(), $plugin['requires_php'], '>=' ) ); + $tested_wp = ( empty( $plugin['tested'] ) || version_compare( $wp_version, $plugin['tested'], '<=' ) ); + $compatible_wp = ( empty( $plugin['requires'] ) || version_compare( $wp_version, $plugin['requires'], '>=' ) ); $action_links = array(); diff --git a/src/wp-admin/includes/plugin-install.php b/src/wp-admin/includes/plugin-install.php index 92fdad384d..f2607cb9ef 100644 --- a/src/wp-admin/includes/plugin-install.php +++ b/src/wp-admin/includes/plugin-install.php @@ -756,9 +756,9 @@ function install_plugin_information() { requires_php ) || version_compare( substr( phpversion(), 0, strlen( $api->requires_php ) ), $api->requires_php, '>=' ) ); - $tested_wp = ( empty( $api->tested ) || version_compare( substr( $wp_version, 0, strlen( $api->tested ) ), $api->tested, '<=' ) ); - $compatible_wp = ( empty( $api->requires ) || version_compare( substr( $wp_version, 0, strlen( $api->requires ) ), $api->requires, '>=' ) ); + $compatible_php = ( empty( $api->requires_php ) || version_compare( phpversion(), $api->requires_php, '>=' ) ); + $tested_wp = ( empty( $api->tested ) || version_compare( $wp_version, $api->tested, '<=' ) ); + $compatible_wp = ( empty( $api->requires ) || version_compare( $wp_version, $api->requires, '>=' ) ); if ( ! $compatible_php ) { echo '

';