Page MenuHomePhabricator

Decide whether extensions should set a PHP version requirement in composer.json
Open, Needs TriagePublic

Description

This has emerged while upgrading PHPCS to the latest version for all repos (and hence, starting to use PHP72+ features). Currently, many extensions have an explicit PHP version requirement in composer.json.

Aside from special cases (i.e. extensions which already required PHP7+), several extensions require PHP 5.6.99+, which was the "correct" value as long as we supported HHVM.

Others have different requirements, varying from 5.0.0 (!) to 5.5.9. For some of them, it's safe to assume that the intention was to require the same version as MW core, but they fell out of date.

However, others are actually (claimed to be) compatible with PHP5. For instance, some extensions with "master" compatibility.

The goal of this task is to understand whether, and under what premises, an extension may set an explicit PHP requirement in its composer.json. And ideally, what PHP versions are admissible, too.

Personally, I think it doesn't make any sense to try to support a PHP version < than the version supported by the oldest supported release of MW.

For instance, since right now MW 1.31 is the oldest supported version and it only supports HHVM or PHP7+, *every* extension should do the same (i.e. the composer requirement should be 5.6.99+). IMHO this is a no-brainer.


I (@Daimona) think that extensions should *not* have an explicit PHP version requirement, unless it's (meant to be) different from the one in core.

Event Timeline

Daimona created this task.Oct 10 2019, 9:47 AM
Reedy added a subscriber: Reedy.Oct 10 2019, 2:04 PM

I (@Daimona) think that extensions should *not* have an explicit PHP version requirement, unless it's (meant to be) different from the one in core.

That's kinda the view I'd taken, at least when adding or suggesting others to add them. For example the WebAuthn, which needed PHP 7.2 due the the 3rd party libraries it used, but it was mostly developed when MW master still needed HHVM support and therefore it could've used HHVM

It's worth noting an extension can set it in extension.json too, which can have differing results. Which can potentially give some other clues... If the file has a requires MW >= some old version, the PHP version might make more sense. Especially as we're trying to be more rigorous about setting the requires MW in extension.json, so we don't necessarily have to enforce the "use the same branch of MW for the extension" -- if master says it should work... It should work (or else that's a separate bug)

I implemented the php requirements for extension.json, and @Legoktm and me thought it should be used the same way @Daimona proposes: A php requirement should only be specified, if an extension requires a php version higher than the minimum supported php version for the minimum supported MW core version. I think for composer.json, we should use the same approach.

Reedy added a comment.Oct 10 2019, 6:50 PM

I implemented the php requirements for extension.json, and @Legoktm and me thought it should be used the same way @Daimona proposes: A php requirement should only be specified, if an extension requires a php version higher than the minimum supported php version for the minimum supported MW core version. I think for composer.json, we should use the same approach.

Got the task/reference to hand? Always worth linking back where possible

Nikerabbit moved this task from Inbox to Watching on the TechCom board.Oct 16 2019, 7:07 PM