Skip to content

Drop compatibility with PHP 7.2 and 7.3#22077

Merged
igorschoester merged 10 commits intotrunkfrom
feature/drop-php-7.2-7.3
Apr 15, 2025
Merged

Drop compatibility with PHP 7.2 and 7.3#22077
igorschoester merged 10 commits intotrunkfrom
feature/drop-php-7.2-7.3

Conversation

@enricobattocchi
Copy link
Copy Markdown
Member

@enricobattocchi enricobattocchi commented Feb 26, 2025

Context

Summary

This PR can be summarized in the following changelog entry:

  • Drops compatibility with PHP 7.2 and 7.3.

Relevant technical choices:

  • important: the changes by themselves don't really mean anything for the plugin: I haven't applied any change in the code to e.g. use newer code standards etc. By stopping checks (linting + testing) we just won't support older PHP versions in the future.
  • the PR also removes the WHIP notification. Since it was triggered only with PHP < 7.4, and the plugin is not going to work with it, there is no way to actively check for its removal of course. We'd also need to check there are no errors for the missing yoast/whip library when upgrading Free or Premium.

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  • Verify the GH actions pass
  • install on a PHP 7.2 environment
  • visit the Plugins page
  • see that you get the same message and you can't activate the plugin
    Screenshot 2023-03-03 at 11-14-32 Plugins ‹ debug — WordPress
  • the same should happen with 7.3

note: the above may be tricky to test. I can see 7.3 as a choice in Local by Flywheel, but I know it's not the case for others (and I can see 7.2 is not available)
I tried on Instawp, where you have the full choice of PHP versions, but when uploading the artifact I got:
Screenshot 2025-04-15 at 08-23-47 Upload Plugin ‹ oldphp — WordPress

So a way could be:

  • start a 7.4+ site on instawp
  • upload the artifact but don't activate it
  • switch to 7.3
  • check that you get the same message above and you can't activate the plugin
  • switch to 7.2
  • the same should happen

Relevant test scenarios

  • Changes should be tested with the browser console open
  • Changes should be tested on different posts/pages/taxonomies/custom post types/custom taxonomies
  • Changes should be tested on different editors (Default Block/Gutenberg/Classic/Elementor/other)
  • Changes should be tested on different browsers
  • Changes should be tested on multisite

Test instructions for QA when the code is in the RC

  • QA should use the same steps as above.

QA can test this PR by following these steps:

Impact check

This PR affects the following parts of the plugin, which may require extra testing:

UI changes

  • This PR changes the UI in the plugin. I have added the 'UI change' label to this PR.

Other environments

  • This PR also affects Shopify. I have added a changelog entry starting with [shopify-seo], added test instructions for Shopify and attached the Shopify label to this PR.

Documentation

  • I have written documentation for this change. For example, comments in the Relevant technical choices, comments in the code, documentation on Confluence / shared Google Drive / Yoast developer portal, or other.

Quality assurance

  • I have tested this code to the best of my abilities.
  • During testing, I had activated all plugins that Yoast SEO provides integrations for.
  • I have added unit tests to verify the code works as intended.
  • If any part of the code is behind a feature flag, my test instructions also cover cases where the feature flag is switched off.
  • I have written this PR in accordance with my team's definition of done.
  • I have checked that the base branch is correctly set.

Innovation

  • No innovation project is applicable for this PR.
  • This PR falls under an innovation project. I have attached the innovation label.
  • I have added my hours to the WBSO document.

Fixes #

@enricobattocchi enricobattocchi added the changelog: other Needs to be included in the 'Other' category in the changelog label Feb 26, 2025
@coveralls
Copy link
Copy Markdown

coveralls commented Feb 27, 2025

Pull Request Test Coverage Report for Build d6112f48a78380ef0e30c3424c33b8a053eaa052

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 2163 unchanged lines in 182 files lost coverage.
  • Overall coverage decreased (-2.1%) to 52.454%

Files with Coverage Reduction New Missed Lines %
admin/class-admin-init.php 1 0.0%
admin/class-option-tabs-formatter.php 1 0.0%
src/actions/importing/aioseo/aioseo-posts-importing-action.php 1 46.51%
src/config/conflicting-plugins.php 1 0.0%
src/config/migrations/20201216124002_ExpandIndexableIDColumnLengths.php 1 0.0%
src/config/migrations/20201216141134_ExpandPrimaryTermIDColumnLengths.php 1 0.0%
src/dashboard/domain/content-types/content-types-list.php 1 15.38%
src/dashboard/infrastructure/taxonomies/taxonomies-collector.php 1 0.0%
src/dashboard/user-interface/configuration/site-kit-configuration-dismissal-route.php 1 84.62%
src/dashboard/user-interface/configuration/site-kit-consent-management-route.php 1 84.62%
Totals Coverage Status
Change from base Build 924d36d9165c1071254349d85c1a9fc3ec4af044: -2.1%
Covered Lines: 29025
Relevant Lines: 56379

💛 - Coveralls

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 4, 2025

A merge conflict has been detected for the proposed code changes in this PR. Please resolve the conflict by either rebasing the PR or merging in changes from the base branch.

Copy link
Copy Markdown
Contributor

@jrfnl jrfnl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @enricobattocchi, as requested, I've reviewed this PR. Please find my review notes below.

Also needs/prerequisite ⚠️

  • PR to YoastCS to update the testVersion used by PHPCompatibility as otherwise any and all modernizations would be blocked.
  • Release of a new version of YoastCS containing the above PR (please co-ordinate with me as there are other changes lined up for YoastCS).

Missed references which should be updated ⚠️

  • composer.json: drop dependency on yoast/whip
  • VERSIONS.json - line 16 - 7.2 => 7.4. (or is this updated automatically ?)

Other updates which need to be made ❗

  • .github/workflows/lint.yml - this workflow needs changing as the second PHP install is no longer needed (but don't just blindly remove it, certain steps need to be merged).
  • github/workflows/test.yml - this workflow needs changing in both jobs as the second PHP install is no longer needed (but don't just blindly remove it, certain steps need to be merged).
  • .github/workflows/finish-coveralls.yml - line 108 - the names of the builds which should potentially be carried forward need to be brought in line with the changes made in the test.yml workflow.

Composer updates which can/should be made

In this PR/directly related to the version drop ✅

none

The following updates need to be made in separate PRs in a managed fashion as code changes may (will) be needed in the code using these dependencies

symfony/config                              3.4.32             5.4.46             Symfony Config Component
symfony/dependency-injection                3.4.47             5.4.48             Symfony DependencyInjection Component

☝️ IIRC, this one is on @thijsoo's radar.

humbug/php-scoper                           0.13.8             0.17.5             Prefixes all PHP namespaces in a file or directory.
psr/container                               1.0.0              1.1.2 or 2.0.2     Common Container Interface (PHP FIG PSR-11)

The following updates can/should be made aside from this PR (unrelated to the version drop)

guzzlehttp/guzzle                           7.8.1              7.9.2              Guzzle is a PHP HTTP client library
humbug/php-scoper                           0.13.8             0.13.9             Prefixes all PHP namespaces in a file or directory.
league/oauth2-client                        2.7.0              2.8.1              OAuth 2.0 Client Library
psr/container                               1.0.0              1.1.0              Common Container Interface (PHP FIG PSR-11)

Automated tests run on PHP 7.4.0

Needed some digging in dusty archives, but I managed to find an old PHP 7.4.0 archive, installed it and I have run the tests against that version to verify that the absolute minimum supported PHP version (according to this PR) works (based on the available tests).

  • Unit Tests: ✅
  • WP Tests: ✅

The caveat is, of course, that test coverage is low, so this is no guarantee, only a tentative indication.

Follow up which is needed (outside the scope of this PR):

  • YoastCS: decide if and if so, which new CS rules we want to start enforcing now support for PHP < 7.4 will be dropped.
  • I think the PHP/WP matrix should probably get a second look, but that doesn't need to be done in this PR. Might even be better to combine this with the PR which adds PHP 8.4 to the matrix (once we can).

Hope this helps.

Comment thread .github/workflows/test.yml Outdated
Comment thread .github/workflows/test.yml Outdated
@jrfnl
Copy link
Copy Markdown
Contributor

jrfnl commented Mar 4, 2025

FYI: I also still found some bits and pieces of code which can be removed now. I've made some local commits for this now. These can either be added to this PR or pulled separately once this PR has been merged.

@jrfnl
Copy link
Copy Markdown
Contributor

jrfnl commented Mar 4, 2025

Other updates which need to be made ❗

  • .github/workflows/lint.yml - this workflow needs changing as the second PHP install is no longer needed (but don't just blindly remove it, certain steps need to be merged).
  • github/workflows/test.yml - this workflow needs changing in both jobs as the second PHP install is no longer needed (but don't just blindly remove it, certain steps need to be merged).

This may need a little investigation, as I'm getting a tingly feeling that running the dependency injection + scoping on recent PHP versions may fail due to the outdated versions of the dependencies being used, so we may not be able to get rid of the extra steps yet, but in that case, we need to update the comments in the script to explain why the steps are still needed.

@enricobattocchi enricobattocchi force-pushed the feature/drop-php-7.2-7.3 branch from 885d4d0 to 8da99ec Compare March 5, 2025 09:03
@private-packagist
Copy link
Copy Markdown

private-packagist Bot commented Mar 5, 2025

composer.lock

Package changes

Package Operation From To About
yoast/whip remove 2.0.0 - -

Settings · Docs · Powered by Private Packagist

@github-actions
Copy link
Copy Markdown

A merge conflict has been detected for the proposed code changes in this PR. Please resolve the conflict by either rebasing the PR or merging in changes from the base branch.

@github-actions
Copy link
Copy Markdown

A merge conflict has been detected for the proposed code changes in this PR. Please resolve the conflict by either rebasing the PR or merging in changes from the base branch.

@github-actions
Copy link
Copy Markdown

A merge conflict has been detected for the proposed code changes in this PR. Please resolve the conflict by either rebasing the PR or merging in changes from the base branch.

@enricobattocchi enricobattocchi force-pushed the feature/drop-php-7.2-7.3 branch from 36ce5cd to 9091adb Compare March 21, 2025 14:57
@private-packagist
Copy link
Copy Markdown

The composer.lock diff comment has been updated to reflect new changes in this PR.

@enricobattocchi enricobattocchi force-pushed the feature/drop-php-7.2-7.3 branch from 9091adb to 56db040 Compare April 14, 2025 12:24
@private-packagist
Copy link
Copy Markdown

The composer.lock diff comment has been updated to reflect new changes in this PR.

@enricobattocchi enricobattocchi marked this pull request as ready for review April 15, 2025 07:05
Copy link
Copy Markdown
Contributor

@igorschoester igorschoester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AT ✅

@igorschoester igorschoester added this to the 25.0 milestone Apr 15, 2025
@igorschoester igorschoester merged commit d5c0395 into trunk Apr 15, 2025
33 checks passed
@igorschoester igorschoester deleted the feature/drop-php-7.2-7.3 branch April 15, 2025 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: other Needs to be included in the 'Other' category in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants