Skip to content

Instantly share code, notes, and snippets.

@sminnee
Last active March 28, 2017 23:42
Show Gist options
  • Select an option

  • Save sminnee/d044c2291420056d826a31bbf7eaa914 to your computer and use it in GitHub Desktop.

Select an option

Save sminnee/d044c2291420056d826a31bbf7eaa914 to your computer and use it in GitHub Desktop.
RFC: PHP7 support in SS3

RFC: PHP7 support in SilverStripe 3

Problem: we only have ~15 months between SS4 stable release and SS3 end-of-life.

Right now SS3's end-of-life is tied to the end-of-life of the PHP version that it requires - 5.6. This is December 2018. We're targetting an October 2017 release for SS4 stable, which only leaves a 15 months window for people to upgrade.

For comparison, we had 33 months (2 years, 9 months) between 3.0 being released and 2.4 being end-of-life'd.

15 months is too short a window and we would like a minimum of 2 years.

Solution: PHP7 support in SS3

In order to resolve this, we want to support PHP7 in SS3. This could start at 3.6. However, as this requires an API breakage, we would be breaking semantic versioning to do this.

Having discussed it as a core team, we don't want to have semantic versioning be something that we do when convenient, and so we've come up with another solution: we will put the breaking version of SS3 into a separate package, silverstripe/framework3lts

What this will means is that the version list will look a bit unusual:

  • SilverStripe 2.0 - 3.5: silverstripe/framework
  • SilverStripe 3.6 - 3.999: silverstripe/framework3lts
  • SilverStripe 4.0+: silverstripe/framework

If you don't want to worry about this, you can skip straight from 3.5 to 4.0. But if you want to get onto PHP7 before upgrading to SS4, you will have a way forward that doesn't require pulling in patches to your system.

Specifics:

  • 3.5 is the last minor 3.x release on the silverstripe/framework package. We support this minor release with security fixes until Dec 2018
  • We create package silverstripe/framework3lts, by forking the 3 branch of silverstripe/framework.
    • composer.json will indicate provides = silverstripe/framework, so we can
    • php requirements will be PHP 5.5 - 7.1,
    • We rename the Int class to DBInt, the Float class to DBFloat, and make use of Injector for instantiating field types, with "Int" and "Float" set up as service names.
  • 3.6 is the first release on silverstripe/framework3lts.
  • It’s supported with minor releases until Dec 2019
  • From version 3.6 onwards, silverstripe/installer includes silverstripe/framework3lts, so that newly created projects start on this version.

Outcomes

Most things should be okay:

  • If you have projects using silverstripe/framework:^3.x, you will pull in updates up to 3.5, 3.6 won't be included, and you won't get any class renames.
  • If you create projects after 3.6 is released, they will make use of the new version.
  • If you wish to switch your servers to PHP7, or you wish to upgrade to 3.6 or higher, you will need to add silverstripe/framework3lts:^3.x as a requirement on your project, instead of silverstripe/framework.

There is one small caveat:

  • If you have upgraded to 3.6
  • ...and you install modules
  • ...and those modules make direct references to the Int or Float classes
  • ...and those modules don't have a specical 3.6+ version yet

Then you will run into issues, and you will need to contribute a 3.6+ version of the module as well as patching the original version of the module to tbe 3.x-3.5 only.

However, we expect that this situation will be rare as direct references ot the Int and Float classes are rare.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment