PHP is continuously under development to improve performance and security with every released version. Though every version brings improvements, sometimes new requirements for code syntax or breaking changes are introduced as well.
It is important for developers to set time aside to prepare an application’s codebase for a PHP version update. This helps to ensure that an update process is as smooth as possible.
Refer to the PHP Manual Appendices for more details about the changes included in newer versions of PHP.
Methods for scanning and testing code
Developers should begin the process of a PHP version update by using some or all of the following methods to identify potential compatibility issues with a newer version of PHP:
Several methods are available for identifying potential compatibility issues in application code with a newer version of PHP. Developers should begin the process of a PHP version update by scanning application code with as many methods as possible:
- PHPCS scans for PHP version compatibility
- PHP linting for PHP version compatibility
- Static analysis tools for PHP version compatibility
- Automated tests for PHP version compatibility
After scanning code locally and making updates to application code to resolve identified incompatibilities, additional testing should be performed on a non-production VIP Platform environment.
Code that should be scanned and tested
When preparing for a PHP version update, all code in an application’s GitHub repository should be scanned and modified as needed for compatibility. An application’s codebase likely includes a combination of custom code written specifically for that application, as well as third-party code written by authors not associated with the application’s development team.
PHP development tools such as Composer, PHPUnit, PHP_CodeSniffer, PHPStan Several methods are available to prepare for a PHP version update requires several steps including local code scanning and modification as well as performing tests on a non-production VIP Platform environment.
Custom plugins or themes
All custom code added to an application’s GitHub repository must be scanned and tested for compatibility for a PHP version update. The developers who originally wrote the custom code are often the best candidates to perform scans and make necessary updates. However, the feedback provided by the recommended scanning methods is actionable by any PHP developer familiar with the application’s codebase.
Third-party plugins or themes
If PHP incompatibilities are found in the code for third-party plugins or themes, they can be reported to the plugin or theme authors. Some authors are quick to respond to upcoming versions of PHP and release updated and compatible versions of their plugin or theme.
Customers can also optionally consider:
- Adding a different, alternative plugin or theme that is compatible with the next version of PHP and provides the same functionality. All third-party plugins and themes should be evaluated for performance and security before enabling them on a production environment.
- Forking the plugin code where modifications can be made to the code to make it compatible with the updated version of PHP. Choosing this option places the responsibility of maintaining the forked code on the customer’s development team.
Last updated: December 26, 2023