Opened 7 years ago
Closed 7 years ago
#2952 closed task (blessed) (fixed)
Plugin Directory: Allow minimum PHP version requirement
Reported by: | SergeyBiryukov | Owned by: | |
---|---|---|---|
Milestone: | Plugin Directory v3.0 | Priority: | normal |
Component: | Plugin Directory | Keywords: | has-patch |
Cc: |
Description (last modified by )
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)
Change History (29)
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
@
7 years ago
#6
@
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
@
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:
- Refuse to initially install a plugin/theme where the system doesn't meet the minimum PHP version requirements.
- 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!).
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
This ticket was mentioned in Slack in #hosting-community by joostdevalk. View the logs.
7 years ago
#15
follow-up:
↓ 17
@
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
@
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
@
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
@
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
@
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.
#20
@
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.
This ticket was mentioned in Slack in #hosting-community by danielbachhuber. View the logs.
7 years ago
#23
@
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).
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 comment:17:ticket:40934 and @joyously in comment:29:ticket:40934, 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
orRequires at least
andTested
orTested up to
. MaybeRequires PHP: x.x
andTested PHP: x.x
?2952.2.patch is a refreshed patch that uses
Requires PHP: x.x
, which got some approval.