Making WordPress.org

Opened 7 years ago

Closed 7 years ago

#2952 closed task (blessed) (fixed)

Plugin Directory: Allow minimum PHP version requirement

Reported by: sergeybiryukov's profile SergeyBiryukov Owned by:
Milestone: Plugin Directory v3.0 Priority: normal
Component: Plugin Directory Keywords: has-patch
Cc:

Description (last modified by SergeyBiryukov)

Background: #WP40934

The idea of having minimum PHP version requirements for plugins and themes was recently "blessed" and milestoned for 4.9. As discussed in the latest #core-php meeting:

It should be possible to specify a minimum required PHP version for plugins. Once this is supported by core, it is likely that more plugins will raise their minimum requirement, so it will eventually be another way to make people aware.

The ticket includes some Meta-related tasks:

  • Plugin readme parser changes for minimum PHP version requirement.
  • Plugins API changes.
  • Show minimum required PHP version on plugins page.
  • (Optional) Allow filtering plugin directory.
  • (Optional) Report PHP version usage per plugin’s users.

Attached is a preliminary patch that introduces a Minimum PHP Requires PHP header and displays it in Plugin Meta widget, implementing the first three points.

Attachments (4)

2952.patch (11.7 KB) - added by SergeyBiryukov 7 years ago.
2952.PNG (9.7 KB) - added by SergeyBiryukov 7 years ago.
2952.2.patch (11.7 KB) - added by SergeyBiryukov 7 years ago.
2952.3.patch (1.0 KB) - added by SergeyBiryukov 7 years ago.

Download all attachments as: .zip

Change History (29)

@SergeyBiryukov
7 years ago

@SergeyBiryukov
7 years ago

#1 @SergeyBiryukov
7 years ago

  • Description modified (diff)

This ticket was mentioned in Slack in #meta by ipstenu. View the logs.


7 years ago

This ticket was mentioned in Slack in #meta by tellyworth. View the logs.


7 years ago

This ticket was mentioned in Slack in #core-php by sergey. View the logs.


7 years ago

#5 @SergeyBiryukov
7 years ago

Per the latest #core-php meeting, the current patch should be good to go, with an announcement on make/plugins upon commit.

A point was raised that adding a "tested up to" PHP version, as suggested by @jb510 in 40934#comment:17 and @joyously in 40934#comment:29, might also be beneficial, but that can be explored in a new ticket and should not prevent the Minimum PHP header from being committed.

That said, I've asked for some additional feedback on new header names. the current patch uses Mininum PHP: x.x, as that's what was initially suggested in #WP23880. Given the potential addition of a "tested up to" PHP version header in the future, I think it would make sense to mirror the WP version headers: Requires or Requires at least and Tested or Tested up to. Maybe Requires PHP: x.x and Tested PHP: x.x?

2952.2.patch is a refreshed patch that uses Requires PHP: x.x, which got some approval.

Last edited 7 years ago by SergeyBiryukov (previous) (diff)

#6 @GaryJ
7 years ago

Requires PHP: has an advantage, if the version number might later change from a static number to semantic version string like ^5.6|^7 or >=5.3,<7.0. These values wouldn't make sense with a Minimum PHP header, as the string may also specify maximum supported versions too.

This ticket was mentioned in Slack in #meta by sergey. View the logs.


7 years ago

#8 @rklrkl
7 years ago

I love this idea because when a plugin needs a newer version of PHP than core WordPess (currently 5.2.4 is the bare minimum), this is almost never mentioned on the plugin download page by the author (I complain about this on their support forums when I see this, but I generally get ignored).

I haven't followed the full discussion of this, but if these two "obvious" ideas haven't been considered, you might want to throw them into the pot:

  1. Refuse to initially install a plugin/theme where the system doesn't meet the minimum PHP version requirements.
  1. Refuse to upgrade to a new version of a plugin/theme because the new version needs a newer PHP version than the one that's installed (this will stop auto-updates from breaking plugins/themes because of PHP versioning issues - this has happened to us several times). I don't know how easy this is though because you'd have to know the new version's PHP minimum requirements in advance (probably before the delete/deactivate/install/activate of the new version).

BTW, I'm assuming that if a plugin/theme doesn't provide a minimum PHP version header, it will default to 5.2.4 (which will be wrong in quite a few cases as I've said - many plugin authors just look at the "recommended" version and not the minimum one!).

#9 @SergeyBiryukov
7 years ago

  • Description modified (diff)

This ticket was mentioned in Slack in #core-php by jdgrimes. View the logs.


7 years ago

This ticket was mentioned in Slack in #meta by tellyworth. View the logs.


7 years ago

This ticket was mentioned in Slack in #meta by tellyworth. View the logs.


7 years ago

#13 @tellyworth
7 years ago

In 5841:

Plugin directory: soft launch support for Requires PHP header in readme.txt. Props @SergeyBiryukov

See #2952

This ticket was mentioned in Slack in #hosting-community by joostdevalk. View the logs.


7 years ago

#15 follow-up: @SergeyBiryukov
7 years ago

As reported by @johnbillion in #3080, readme validator now displays a warning if Requires PHP header is missing. This was an oversight, it should not be a required header.

2952.3.patch removes it from Validator::validate_content(). cc @tellyworth

#16 @jrf
7 years ago

@SergeyBiryukov What about adding it as a "Note" instead, just like for a missing "Donate" link or a missing screenshots section ?

#17 in reply to: ↑ 15 @pputzer
7 years ago

Replying to SergeyBiryukov:

As reported by @johnbillion in #3080, readme validator now displays a warning if Requires PHP header is missing. This was an oversight, it should not be a required header.

2952.3.patch removes it from Validator::validate_content(). cc @tellyworth

I stumbled upon that by accident and I think it's actually a great idea to encourage people to add the "Required PHP" information. Even if they add "5.2", that is way more valid than just assuming by default that something is compatible with 5.2. As a plugin developer, I'd advocate for keeping in the warning.

#18 @Otto42
7 years ago

The warning should stay there for the validator. We don't "require" anything that the validator says, and since they should have it then the validator should check for it and mention it when it's missing.

I recommend not changing the validator.

#19 @SergeyBiryukov
7 years ago

Sounds good to me, I have no problem with showing a warning if the header is missing, as long there's a consensus on doing so.

Last edited 7 years ago by SergeyBiryukov (previous) (diff)

#20 @schlessera
7 years ago

I'd vote for leaving the warning in there as well. It is not an error, only a warning, so you are still free to omit it. But it will incite people to actually think about what PHP version their plugin actually needs.

#21 @SergeyBiryukov
7 years ago

Created #3123 for adding the Requires PHP header to the readme standard.

This ticket was mentioned in Slack in #hosting-community by danielbachhuber. View the logs.


7 years ago

#23 @danielbachhuber
7 years ago

Has there been much discussion around PHP incompatibility between versions?

For instance, if my plugin Requires PHP: 5.6, it's not safe for WordPress to assume my plugin works with PHP 7.0.

Ideally, my plugin would indicate each PHP version it's been tested against and known to be fully compatible with.

(Feel free to point me in the right direction of this conversation is already being held elsewhere).

This ticket was mentioned in Slack in #meta by tellyworth. View the logs.


7 years ago

#25 @tellyworth
7 years ago

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

Seems like #3123 covers the remaining issue here.

Note: See TracTickets for help on using tickets.