WordPress.org

Make WordPress Core

Opened 9 months ago

Closed 10 days ago

#48245 closed enhancement (fixed)

Add extra details to the error message for a plugin's minimum supported PHP version

Reported by: johnbillion Owned by: johnbillion
Milestone: 5.5 Priority: normal
Severity: normal Version: 5.3
Component: Site Health Keywords: has-patch
Focuses: Cc:

Description

When activating a plugin which has a minimum PHP version version requirement that's higher than that which is installed, the following message is shown in a wp_die() error:

Current PHP version does not meet minimum requirements for <plugin>.

This is a blocking error and doesn't provide the user with any information to help them make a decision about what to do next.

Some helpful information should be added to this screen:

  • The plugins' minimum required PHP version
  • The current PHP version
  • A link to the support documentation on how to update PHP

Attachments (2)

48245.diff (1.6 KB) - added by stuffradio 2 weeks ago.
48245.2.diff (110.9 KB) - added by stuffradio 12 days ago.

Download all attachments as: .zip

Change History (19)

@stuffradio
2 weeks ago

#1 @stuffradio
2 weeks ago

I added a patch that shows what the required minimum PHP version should be, and I modified the scope so it will also show the minimum required WordPress version as well.

This ticket was mentioned in Slack in #core by sabernhardt. View the logs.


2 weeks ago

#3 @davidbaumwald
2 weeks ago

  • Keywords has-patch added; needs-patch removed

#4 @johnbillion
2 weeks ago

  • Component changed from Plugins to Site Health
  • Keywords servehappy removed
  • Milestone changed from Awaiting Review to Future Release
  • Owner set to johnbillion
  • Status changed from new to reviewing

#5 follow-up: @johnbillion
2 weeks ago

Thanks for the patch @stuffradio.

I've taken a look and I've got some feedback for you. If you'd like to submit an updated patch you can upload it with the same file name.

  1. In order to aid translators when there are multiple placeholders within a string, these need to use the numbered placeholder syntax, eg %1$s, %2$s, and the translator comment above it should be numbered accordingly. Example: https://core.trac.wordpress.org/browser/trunk/src/wp-activate.php?rev=47550&marks=147-148#L139
  2. The string that's used when neither the required WordPress nor PHP versions are met needs some more clarity to explain that the two version numbers refer to WordPress and PHP respectively.
  3. I still think that including the current WordPress and/or PHP version number in the messages will help users. They might be more inclined to arrange an update than they would be if they had no idea which version they're currently on.
  4. The support article at https://wordpress.org/support/update-php/ includes useful information about updating PHP. We should link to this article at the end of this message about updating PHP. There's a useful article on updating WordPress too: https://wordpress.org/support/article/updating-wordpress/.

#6 @stuffradio
2 weeks ago

Thanks for your feedback @johnbillion. I will probably revise the patch on Monday.

#7 in reply to: ↑ 5 @garrett-eclipse
2 weeks ago

Replying to johnbillion:

  1. The support article at https://wordpress.org/support/update-php/ includes useful information about updating PHP. We should link to this article at the end of this message about updating PHP. There's a useful article on updating WordPress too: https://wordpress.org/support/article/updating-wordpress/.

@stuffradio please note WP provides wp_get_update_php_url, a filterable function for the PHP update URL.
You can probably follow this convention that’s already in core.
*I don't believe there's a similar function for updating-wordpress, only instance of that is in this message from core.

#8 @sabernhardt
2 weeks ago

@stuffradio I recommend waiting to create another patch here until after the next commit on ticket #47656. The Error prefix is supposed to be added back on these messages soon.

#9 @sabernhardt
2 weeks ago

The Error prefixes were added back yesterday in [48115]

#10 @stuffradio
12 days ago

I have created a new patch. I hope this reflects the given feedback. :)

@stuffradio
12 days ago

#11 follow-up: @stuffradio
12 days ago

I pulled the latest code before creating the patch, so I guess that got added to the patch as well.

This ticket was mentioned in Slack in #core by stuffradio. View the logs.


11 days ago

#13 in reply to: ↑ 11 @SergeyBiryukov
11 days ago

  • Keywords needs-refresh added

Replying to stuffradio:

I pulled the latest code before creating the patch, so I guess that got added to the patch as well.

Thanks for the patch! There appear to be some formatting issues with it, though. Apparently the IDE replaced all tabs with spaces, so it's very hard to see what was actually changed.

Could you refresh the patch without the formatting changes?

This ticket was mentioned in Slack in #core by stuffradio. View the logs.


10 days ago

#15 @williampatton
10 days ago

  • Keywords needs-refresh removed

Patch in the linked PR seems to resolve the needed refresh. It is still waiting on tests to run but seems better to me :)

#16 @SergeyBiryukov
10 days ago

  • Milestone changed from Future Release to 5.5

#17 @SergeyBiryukov
10 days ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 48172:

Site Health: Improve the error message displayed when activating a plugin that requires a higher version of PHP or WordPress.

This adds some extra details to the message:

  • The current PHP or WordPress version.
  • The plugin's minimum required PHP or WordPress version.
  • A link to the support documentation on how to update PHP.

Props stuffradio, johnbillion, garrett-eclipse, sabernhardt, williampatton, SergeyBiryukov.
Fixes #48245.

Note: See TracTickets for help on using tickets.