What is PHP?
PHP is a programming language that is used by Reward Gateway to create many of our products. Much like software, a programming language can be upgraded to provide the following:
- More stable and faster performance
- New syntax and programming features
- Security and other critical bug fixes
Why the change?
PHP 8 was released in November 2020 and was a major update that introduced many optimisations and powerful features to the language. It also brought “breaking changes”, – changes that result in an error when code is no longer supported. This meant that if we launched on PHP 8 without checking if Reward Gateway’s code was compatible with the upgrade, we could end up with end-user journeys and functionality not working.
At the same time as the release of PHP 8, the provider of PHP announced that earlier versions of PHP were marked as “end of life” – or no longer supported – in December 2022.
The Engineering team has worked quietly on addressing the breaking changes across all of Reward Gateway’s 2 million lines of code ahead of this date. This required significant effort to validate, and in this post, we wanted to take the time to explain a bit more about our approach to this for both PHP and our other dependencies.
What goes into an upgrade like this?
For us, the project started in April 2022 when some of the Engineering team began to evaluate the impact of the PHP 8 upgrade on Reward Gateway’s code base. Their analysis suggested that this was a significant project. A working group was formed to address these issues and members of the Core Platform and other teams contributed.
This upgrade had implications for “libraries” – pieces of code that help us, for example, render a chart in a document, as well as Reward Gateway’s own code. The working group started by checking the compatibility of each of these and worked to plan upgrades, replacements, or removal of the impacted libraries.
The working group set up a process to log and collect “deprecation notices” – indicators of breaking changes. These logs were also reviewed, and changes were sponsored in Reward Gateway’s code to remediate them. By September, we saw our automated unit tests, which look at each function’s output, passing with no deprecations logged.
However, some areas of our code remained without unit test suites covering them – or guaranteeing that the behaviour was still correct. Here the team used our integration tests, which simulate real user page activity with a web browser, to collect further areas and issues requiring triage.
Getting ready to launch
Even with all our diligence around making the compatibility changes and ensuring that they do not cause any regression with products, this is a significant upgrade to our core technology stack. We always want to have a back-out plan for changes like these.
Our Operations team stepped in here to change the supporting infrastructure in a reversible way in case any breaking changes have yet to be discovered. This was launched, and we have been dual-testing every change to Reward Gateway to complete the final phase of the project, the migration.
The Operations team did not just give an on-off switch; they provided a dimmer switch. This allowed us to gradually increased the amount of traffic being served using PHP 8 and the ability to pause if we saw any signs of performance or functionality degradation.
A special thank you
As a business, we ‘stand on the shoulders of giants’ with many of our technology choices and rely on these giants to continue performing important work and upgrading our dependencies.
We have many hundreds of similar dependencies across our products, and while PHP is a larger one, the same skill and care are required for each upgrade. This work is often done quietly in conjunction with the product and feature delivery but is essential to our ongoing success.
Being able to gradually roll out such changes and check for any issues in our logs or negative feedback attributable to a change is a huge effort that has involved the whole of Engineering and Operations. It deserves as much recognition as a new feature launch or enhancement.
Thank you to everyone who was involved!