Upcoming Changes in Photonic – PHP 7.0+ Syntax

I have been holding off on one Photonic change for a while now – dropping support for PHP 5.6.

Here is some background for context:

  1. WordPress has a tradition of supporting a lot of deadweight PHP versions.
  2. Up until WP 5.1, it used to support PHP 5.2+. At that time, the active PHP version was 7.3, and 5.3+ was no longer supported by PHP itself.
  3. In WP 5.2, the minimum PHP version was moved up to PHP 5.6+. This was about 4 years back, and was necessary, but nowhere near sufficient. It however let me rewrite some code and put in some much-desired improvements.
  4. Attempts were made by volunteers to bring up the minimum version required again. But these were shot down by none other than Matt Mullenweg, who said that support should be dropped only when a PHP version’s usage falls below an arbitrarily threshold of 5%. Apparently Matt was concerned for the people who have essentially abandoned their websites and do not do PHP upgrades.
  5. Sticking to the (still arbitrary) guideline of 5%, a new ticket was created to drop support again, once the usage of PHP 5.6 fell below 5%. At the time of writing this, PHP 5.6 has a usage of 4.4%.
  6. Enter the overlords again… and this proposal again seems to be going nowhere, since the naysayers argue that the combined versions of PHP 5.6 and lower add up to more than 5%. They do seem to be ignoring the fact that those users who are on PHP 5.3* or lower should anyway be excluded from the count.

In any case, quite a few releases back, I had bumped up Photonic’s PHP version requirement to 7.0. However, at that time, I did not switch to using any syntax specific to PHP 7.0 or higher. In other words, even if you ran Photonic on PHP 5.6, you would be fine. But with the percentage of WP users on PHP 5.6 falling below 5%, I feel confident enough to make this shift.

Consider this:

  • PHP 5.6 was released in August 2014, its active support ended in January 2017, and its security support ended in December 2018 (before WP made it the minimum supported version).
  • PHP 7.0 was released in December 2015, its active support ended in January 2018, and its security support ended in January 2019.
  • PHP 7.1 was released in November 2016, its active support ended in December 2018, and its security support ended in December 2019.
  • PHP 7.2 was released in November 2017, its active support ended in November 2019, and its security support ended in November 2020.
  • PHP 7.3 was released in December 2018, its active support ended in December 2020, and its security support ended in December 2021.
  • PHP 7.4 was released in November 2019, its active support ended in November 2021, and its security support ended in November 2022.
  • PHP 8.0 was released in November 2020, its active support ended in November 2022, and its security support ends in November 2023.
  • PHP 8.1 was released in November 2021, its active support ends in November 2023, and its security support ends in November 2024.
  • PHP 8.2 was released in December 2022, its active support ends in December 2024, and its security support ends in December 2025.

(Source: https://endoflife.date/php)

So, WP is several years behind PHP support. While WP must not aspire to keep pace with the PHP release cycle (that can only cause chaos), supporting a version that is past active support by 6+ years, and past security support by 4+ years is monumentally stupid, more so since it is used by a measly 4.4% of the user base, who are probably not going to be doing the upgrade to a new version either.

As a result, the next release of Photonic will start introducing syntax that is not backwards-compatible. If you are on PHP 5.6, your site will break. So, if you are using Photonic and are on WP 5.6*, please upgrade to a newer PHP version.