#44350 closed task (blessed) (fixed)
Block plugin updates if required PHP version is not supported - Updates screen
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 5.2 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Site Health | Keywords: | servehappy has-patch commit |
Focuses: | Cc: |
Description
Note: This ticket is a subtask for the overarching #40934 ticket.
When a plugin states it requires a specific minimum PHP version through its "Requires PHP" header information and the server does not support this PHP version, WordPress should block any possibility to update the plugin. This way, plugins will stay at the latest release that still supports the server's PHP version.
This ticket's goal is to prevent plugin updates from the general "Updates" admin screen. With that, it complements #43987, which deals with preventing plugins from the "Plugins" admin screen.
Attachments (18)
Change History (53)
This ticket was mentioned in Slack in #core-php by flixos90. View the logs.
7 years ago
#3
@
7 years ago
44350.diff for removing ability to update from update-core.php
page.
The following screenshot shows the checkbox missing and therefore not possible to update along with a notice regarding PHP updating.
#4
@
7 years ago
- Keywords dev-feedback has-patch added; needs-patch removed
Are we also looking to disable updates if the WP version is not supported?
#5
@
7 years ago
The last discussion on Slack was to change the text to
This plugin doesn’t work with your version of PHP. [Learn more about updating PHP]
I’ll update the patch accordingly unless there are other suggestions.
@schlessera @flixos90 @SergeyBiryukov any other thoughts?
#6
@
7 years ago
Updated patch 44350.2.diff with feedback incorporated.
Not much difference except for updating -> upgrading
This ticket was mentioned in Slack in #core-php by afragen. View the logs.
7 years ago
This ticket was mentioned in Slack in #core by afragen. View the logs.
7 years ago
#9
@
7 years ago
These patches are dependent upon some changes in the patch for #43987 for the View Details window to display a Cannot Update button.
This ticket was mentioned in Slack in #core-php by sergey. View the logs.
7 years ago
#11
@
7 years ago
Translatable strings in core don’t generally seem to be escaped. Just my observation as core translations are more thoroughly vetted.
#12
follow-up:
↓ 14
@
7 years ago
Thanks @afragen
I thought properties of the $plugin_data
like $plugin_data->Name
should be escaped. :)
#13
@
7 years ago
Core seems to be a slightly different case and I don’t honestly know the answer. I’m certain at some point we’ll get some feedback from @flixos90 or @SergeyBiryukov
Though more likely it’s just something I missed and thanks for picking up on it.
#14
in reply to:
↑ 12
@
7 years ago
Replying to miyauchi:
Thanks @afragen
I thought properties of the
$plugin_data
like$plugin_data->Name
should be escaped. :)
If you want to escape the properties, you might use something like esc_attr( $plugin_data )
#15
@
7 years ago
Hi @afragen
esc_attr()
should be used to escape attributes for HTML.
In this case, I think it should esc_html()
.
But I agree to escape the property only as your patch. :)
Thanks. :)
This ticket was mentioned in Slack in #core-php by afragen. View the logs.
7 years ago
This ticket was mentioned in Slack in #core-php by afragen. View the logs.
7 years ago
This ticket was mentioned in Slack in #core-php by afragen. View the logs.
6 years ago
This ticket was mentioned in Slack in #core-php by afragen. View the logs.
6 years ago
#23
@
6 years ago
There is clearly overlap with 43987 and this patch. Also, may need to lint the patch. Sorry. Not sure everyone wants to see yet another iteration.
#25
@
6 years ago
@flixos90 I need to revise the wp_update_php_annotation()
to wp_get_update_php_annotation()
and update this patch too. I found that I really do need to return the annotation and not simply echo it for this patch to work.
I'll make a new ticket for the function rename. #46044
@
6 years ago
updated patch. This will require #46044 to be committed first as it uses new function from that ticket
#27
follow-up:
↓ 28
@
6 years ago
Should this use the compatibility functions from #43992
?
I don't see why escaping the plugin name is required here. It isn't done elsewhere in core. The Version
also isn't escaped, see https://github.com/WordPress/wordpress-develop/blob/6d2f78d9bacf931fb9d4ba031e135c4eb5b17713/src/wp-admin/includes/class-wp-plugins-list-table.php#L802. And the new_version
isn't either, see in that same file when building the view details link.
I think a committer needs to look at that.
If we do want escaping, then I believe, those should be esc_html
. esc_attr
is used elsewhere in that file because the final destination is in href
tags.
#28
in reply to:
↑ 27
@
6 years ago
I was planning on a new ticket/patch for utilizing the new is_wp_compatible()
and is_php_compatible()
later. I didn't want to include them here as I was concerned someone testing the patch would encounter an error that they couldn't easily explain.
As for escaping, I was simply trying to escape before output. If these don't need escaping; I agree that's something for a core-committer to decide.
Replying to TimothyBlynJacobs:
Should this use the compatibility functions from
#43992
?
I don't see why escaping the plugin name is required here. It isn't done elsewhere in core. The
Version
also isn't escaped, see https://github.com/WordPress/wordpress-develop/blob/6d2f78d9bacf931fb9d4ba031e135c4eb5b17713/src/wp-admin/includes/class-wp-plugins-list-table.php#L802. And thenew_version
isn't either, see in that same file when building the view details link.
I think a committer needs to look at that.
If we do want escaping, then I believe, those should be
esc_html
.esc_attr
is used elsewhere in that file because the final destination is inhref
tags.
#30
@
6 years ago
- Keywords needs-testing added; dev-feedback removed
In 44350.13.diff:
- It seems like the closing
<p>
is not needed when displaying the annotation here. Also, the.description
class was causing light gray text on white, which was not good for a11y. Changing to a<span class="description">
fixes the mismatched HTML and the contrast issues. - I removed the added output escaping. The
$plugin_data
variable is populated by_get_plugin_data_markup_translate()
, which passes each value throughwp_kses()
with a list of allowed tags for that attribute.
#32
@
6 years ago
- Keywords commit added
Thanks, @afragen. I was tinkering with the markup a bit on that and included the wrong change.
I attached some screenshots to show what the notices look like now with the final patch.
Also, it looks like one of the escaping calls were re-added in 44350.14.diff (I can remove this before committing). But, otherwise it looks good.
For update-core.php