[wp-trac] [WordPress Trac] #61742: Ensure plugin auto updates are blocked if required WordPress version is not supported
WordPress Trac
noreply at wordpress.org
Wed Jul 24 14:18:41 UTC 2024
#61742: Ensure plugin auto updates are blocked if required WordPress version is not
supported
--------------------------+-----------------------------
Reporter: mguenter | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Plugins | Version:
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
Similar to #46613: In https://github.com/WordPress/wordpress-
develop/commit/26869439ff6b94b103355061e8befebcf93868cd there is an
implementation that checks if the required PHP version is compatible with
the current PHP version while trying to do an auto-update.
We could potentially add the following code after
https://github.com/WordPress/wordpress-
develop/blob/e87f42252b6b09971f21fb27f3a50e1e1fdf26e4/src/wp-
admin/includes/class-wp-automatic-updater.php#L293-L298 to also check for
the required WordPress version:
{{{#!php
<?php
// If updating a plugin or theme, ensure the minimum PHP and WordPress
version requirements are satisfied.
if ( in_array( $type, array( 'plugin', 'theme' ), true ) ) {
if ( ! empty( $item->requires_php ) && version_compare(
PHP_VERSION, $item->requires_php, '<' ) ) {
return false;
}
if ( ! empty( $item->requires ) && is_wp_version_compatible(
$item->requires ) ) {
return false;
}
}
}}}
We had this case from on of your plugin users that the auto update was
executed but the minimum required WordPress version did not match.
Or is there a specific reason why this is not already implemented?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/61742>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list