site-kit-wp: Raise minimum required version of PHP to 7.4

Feature Description

While Site Kit has long supported the minimum version of PHP required by WP, recent changes in core dependencies require that we raise our minimum version to leverage features, fixes, and language compatibility updates that are only available in more recent releases.


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • The minimum required version of PHP should be updated to 7.4
  • All composer dependencies should be updated
  • Any infrastructure specific to older versions of PHP should be updated or removed
    • E.g. Test workflows
  • Must target the release scheduled for April 22
  • Check with @aaemnnosttv before merging a PR for these changes

Implementation Brief

  • Update google-site-kit.php
  • Update composer.json
    • Edit require.php to >=7.4
    • Edit config.platform.php to 7.4.33
  • Update phpcs.xml, in testVersion config increment php version to 7.4-
  • Update https://github.com/google/site-kit-wp/blob/49c312cf8b54f93bce33cc467b7bfad2f48d235f/composer.json#L31 package so instead of replacing everything *, it needs to have >=3.0.36, as versions bellow are added to the conflict list of SecurityAdvisory and composer update will fail
  • The symfony/polyfill-intl-idn package can also be updated to higher version now, we were forced to go with current one in #8094 due to the php version
  • After packages are updated to reflect the changes in the lock file, running php tests - only 1 test is failing at the time of writing.
    • Google\Site_Kit\Tests\Core\Authentication\Clients\OAuth_ClientTest::test_get_authentication_url test is failing as google/apiclient package version (updates to v2.14.0) and in one of the versions it changes the OAuth url path to include v2 - and in this test we are not using proxy so it is expecting https://accounts.google.com/o/oauth2/auth which will be now https://accounts.google.com/o/oauth2/v2/auth. You can see the change in this commit
    • To complete the coverage add new/same test for testing the authentication url but using proxy. More details in this comment
  • Do a proper testing of OAuth redirection, and general smoke testing of the plugin
  • You can check if there is some other critical change that might happened between versions of v2.12.2 and v2.14.0 in the change log. During the definition, I took a brief look, and v2 is the only one I saw, but more might surface during actual execution
  • Some useful documentation for checking deprecated/changed functions - here and here

Test Coverage

  • Not applicable

QA Brief

  • Aside from the increased minimum which should prevent SK from being usable on older versions of PHP, a number of dependencies have been upgraded so we want to do a thorough check that all the core functionality works as expected
  • No visual changes should need checking here, just behavioral
  • Keep an eye out for errors in the browser console and WP debug log if possible
  • It’s possible the changes here have fixed deprecation notices raised on newer versions of PHP such as 8.2 so that is worth checking as well

Changelog entry

  • Update minimum required version of PHP to 7.4.

About this issue

  • Original URL
  • State: closed
  • Created 6 months ago
  • Comments: 15

Most upvoted comments

Assigning this task back to @zutigrm, since he worked on IB for it.

Yeah, we will need to implement the new endpoints on the service side. I have added an asana task for it. https://app.asana.com/0/1199555099685093/1206593581864922/f

UPD: I don’t expect there will be needed significant changes in the current oauth2 process on the service side. We will need to add a new endpoint and bind the existing handler to it. Some changes may be needed for the callback endpoint, but that will be more clear when we start working on it.