From 26869439ff6b94b103355061e8befebcf93868cd Mon Sep 17 00:00:00 2001 From: desrosj Date: Fri, 12 Apr 2019 14:01:02 +0000 Subject: [PATCH] Upgrade/Install: Prevent plugin auto updates if PHP version requirements are not satisfied. In [44937] and [44939], changes were made to prevent a user from updating any plugin that requires a higher version of PHP than the site is running. This compliments those changes to also prevent plugins from being auto updated when the same requirements are not met. Props: TimothyBlynJacobs, davidbaumwald. Fixes #46613. git-svn-id: https://develop.svn.wordpress.org/trunk@45165 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/class-wp-automatic-updater.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/wp-admin/includes/class-wp-automatic-updater.php b/src/wp-admin/includes/class-wp-automatic-updater.php index e3fc5eb784..4a05e9868f 100644 --- a/src/wp-admin/includes/class-wp-automatic-updater.php +++ b/src/wp-admin/includes/class-wp-automatic-updater.php @@ -205,6 +205,13 @@ class WP_Automatic_Updater { } } + // If updating a plugin, ensure the minimum PHP version requirements are satisfied. + if ( 'plugin' === $type ) { + if ( ! empty( $item->requires_php ) && version_compare( phpversion(), $item->requires_php, '<' ) ) { + return false; + } + } + return true; }