Opened 7 years ago
Closed 7 years ago
#3551 closed defect (bug) (fixed)
Plugin Directory: Requires PHP: Standardise on values
Reported by: | dd32 | Owned by: | dd32 |
---|---|---|---|
Milestone: | Priority: | normal | |
Component: | Plugin Directory | Keywords: | needs-patch |
Cc: |
Description
Following on from #2952 a lot of plugins have started implementing the Requires PHP
header.
Unfortunately, a lot of them are not following any form of computer-readable standard.
For example, a quick selection:
PHP 4 Yes 5.3+ 4.6 or greater 5.6 or later 4 & 5 5+ 5.6 or 7.0 4 5.6 or higher >= 5.4 5.4 and higher 4,5 5.4+ (PHP 5.6 + libsodium extension) or (PHP 7.2 or above)
(Yes, some plugins have specified they're PHP 4 compatible, I doubt they are)
A quick look suggests that 2,715 plugins have specified a sane identifier (x.y, or x.y.z) with a further 156 plugins specifying it in ways such as the above list which make it harder to pragmatically use.
I'd recommend that we validate the number in some form in the readme parser to make the data more useful long term.
I'd suggest
- Require the version number be specified as
x.y
orx.y.z
- If Other data is in there, pull out the first version-like string, ie.
5.3
from5.3+
,5.3 or greater
, or5.3-7.1
. Based on existing data, it looks like that should be fine. - Add a warning to the readme validator when unexpected values are encountered and note if it's truncated/sanitised to something reasonable.
Change History (4)
#2
follow-up:
↓ 3
@
7 years ago
They do much the same for the Requires at least: and Tested up to: headers.
I say we simply ignore anything that looks unlike a version number. If they have anything else there, then the header is completely ignored. Force the issue.
#3
in reply to:
↑ 2
@
7 years ago
Replying to Otto42:
They do much the same for the Requires at least: and Tested up to: headers.
That's what caused me to take a sanity look at the Requires data :)
I say we simply ignore anything that looks unlike a version number. If they have anything else there, then the header is completely ignored. Force the issue.
It seems like that's the consensus, so yeah, lets just ignore any non-version data and throw a warning in the validator then.
My opinion on this - take it as you will is to require a valid version number - as you stated;
x.y
orx.y.z
and if invalid, don't show this requires header at all. This would all only correct and relevant data to be shown here.