1

We are upgrading from php 7 to php 8 on our backend. There is a smoke-test automation in place to verify the expected functionaly.

I am thinking if it is feasible to read our php code base and look for deprecated and imcompatible features from php 8 release notes with automated script https://www.php.net/manual/en/migration80.incompatible.php https://www.php.net/manual/en/migration80.deprecated.php if there is a match in our code base, then it is likely to be an issue.

3 Answers 3

2

Scanning for deprecated and incompatible features is a good starting point. Your smoke test automation should catch any critical functionality that's broken.

From there, you may or may not experience more subtle problems with the upgrade: it just depends on precisely what subset of the language you use and what changes have been made.

My recommendation is to be particularly vigilant for a few months after the upgrade, and be prepared for extra bugs to emerge. As an example, we recently upgraded our databases, and found an issue in the order in which the database evaluated nested function calls. Technically, this was a correction from the database provider, but it wasn't something we'd expected or come across during testing. Fortunately, it's a simple fix.

1
  • yeah, should reserve extra points for a few sprints in case upgrade goes wrong
    – Yu Zhang
    Apr 14 at 21:57
1

Yes, some kind of linter / static code analysis tool which checks for deprecated functions should yield some results.

See http://wapmorgan.github.io/PhpDeprecationDetector/

PhpDeprecationDetector detects:

  • Usage of deprecated functions, variables, constants and ini-directives.
  • Usage of deprecated functions functionality.
  • Usage of forbidden names or tricks (e.g. reserved identifiers in newer versions).
1
  • thanks, I did not know anything about this tool. Much appreciated
    – Yu Zhang
    Apr 15 at 2:12
0

Automated testing is an essential part of any software upgrade, and it's great that you are considering it for your PHP upgrade. While it is feasible to use a script to read through your PHP code base and look for deprecated and incompatible features from PHP 8 release notes, it may not be a comprehensive solution.

There are several types of automated tests that you can use to ensure that your PHP 8 upgrade works correctly. Some of them include unit tests, integration tests, and system tests. Unit tests test individual units or modules of your code, while integration tests check the interaction between different components of your application. System tests test the application as a whole and its behavior under different conditions.

In addition to these tests, you can also use tools such as PHP_CodeSniffer or PHPMD to analyse your code and identify any issues that might arise during the upgrade.

To make your testing more comprehensive, you can also consider manual testing in addition to automated testing. Manual testing can help you identify issues that might not be caught by automated tests, such as issues with user interface or user experience.

Overall, using a script to identify deprecated and incompatible features from PHP 8 release notes can be a good starting point, but it's important to consider other types of tests and tools to ensure a successful upgrade.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.