[wp-trac] [WordPress Trac] #47835: PHP requirement always set to null for plugins

WordPress Trac noreply at wordpress.org
Mon Aug 5 10:16:58 UTC 2019


#47835: PHP requirement always set to null for plugins
--------------------------+---------------------
 Reporter:  diddledan     |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  5.3
Component:  Site Health   |     Version:  5.2
 Severity:  minor         |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+---------------------
Changes (by SergeyBiryukov):

 * milestone:  5.2.3 => 5.3


Comment:

 This turned out to be not as straightforward as it seems :)

 Background:
 * [44937] introduced PHP compatibility check in
 `WP_Plugins_List_Table::single_row()`
 * [45185] updated the check to use the new `is_php_version_compatible()`
 function.

 Initially, I thought the check should be updated to use
 `validate_plugin_requirements()` to account for the data both from the
 plugin's main PHP files and `readme.txt`:
 {{{
 $compatible_php = ! is_wp_error( validate_plugin_requirements(
 $plugin_file ) );
 }}}

 However, upon a closer look, the purpose of the PHP compatibility check in
 this particular place is to disable the checkbox that could be used for
 bulk updating plugins, as some of the plugin updates might be
 incompatible.

 The problem with this is that `$plugin_data` refers to the currently
 installed version of the plugin (which should already by compatible per
 the changes in #43986 and #43992), not the updated version that might have
 different requirements.

 The information about the update is only available in
 `wp_plugin_update_row()`, which has its own PHP compatibility check per
 [44937].

 So, unless I'm missing something, the current PHP compatibility check in
 `WP_Plugins_List_Table::single_row()` doesn't work as expected even with
 the proposed variable correction and should be removed. See
 [attachment:"47835.2.diff"].

 Disabling the checkbox for incompatible updates makes sense, but I don't
 see a clean way to do that at the moment.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/47835#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list