Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call _load_textdomain_just_in_time correctly #21729

Conversation

leonidasmi
Copy link
Contributor

@leonidasmi leonidasmi commented Oct 21, 2024

Context

Summary

This PR can be summarized in the following changelog entry:

  • Stops PHP notices about _load_textdomain_just_in_time loading incorrectly, on WP 6.7.

Relevant technical choices:

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  • Install WP 6.7 (at the time of the writing it's on beta3)
  • Change your site language to something other than english
  • Visit both the admin and the frontend of your site and confirm you dont get any PHP notices regarding Function load_plugin_textdomain was called incorrectly or Function _load_textdomain_just_in_time was called incorrectly

Also:

  • Install Yoast SEO in a fresh site, with the site language set to not English (eg. greek)
  • Go to Settings and compare the following settings to what you would get if you installed a previous Yoast SEO version:
    • Author archives - SEO title
    • Special pages - Internal search pages
    • Special pages - 404 error pages
    • RSS - Content to put after each post in the feed`
    • Breadcrumbs - Anchor text for the Homepage
    • Breadcrumbs - Prefix for archive breadcrumbs
    • Breadcrumbs - Prefix for search page breadcrumbs
    • Breadcrumbs - Breadcrumb for 404 page
    • Content types - Search appearance - SEO title (for every public post type you have in your site that have archives - you have to enable Books)
    • Content types - Social media appearance - Social title (for every public post type you have in your site that have archives - you have to enable Books)
    • Categories - Search appearance - SEO title (for every public taxonomy you have in your site)
    • Categories - Social media appearance - Social title (for every public taxonomy you have in your site)
  • Do the same for an english site
  • Do the same for an english site but a non-english user (so, in Users->Profile, you should save a non-english language for Language)
    • In this case, you will get the user language in the above settings instead of the site language - compared to our production versions where you would get the site language

Also:

  • Install the previous Yoast SEO version in a fresh site that's in english
  • Switch the site language to a non-english language
  • Upgrade to the current PR/RC (for devs, make sure to run the upgrade routine if you do it via git checkout)
  • Confirm that the above settings have not been translated to the non-english language
  • Do the above again, but this time install the previous Yoast SEO version in a fresh site that's NOT in english and then switch it to english - again confirm that the settings have not been translated to english after the upgrade

Also:

  • Every time you switch to a different site language, confirm that the above settings do not change
  • Every time you Reset options via the test helper, confirm that the above settings do change, to the current site language

Also (final, I promise):

  • In a fresh site, switch to a non-english language and then install the previous Yoast SEO version
  • Change a couple of the above settings, but not all
  • Uninstall Yoast SEO switch to a different non-english language and then install the current RC/PR
  • Confirm that the settings that you changed before, have stayed the same
  • Confirm that the settings that you didn't change before, have been translated to the new language

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.

Impact check

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

  • The test instructions themselves are mostly impact check

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 https://github.com/Yoast/plugins-automated-testing/issues/1871

@coveralls
Copy link

coveralls commented Oct 21, 2024

Pull Request Test Coverage Report for Build 7837a59bdbf321fc11319b1d503a5dc295740215

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

  • 61 of 75 (81.33%) changed or added relevant lines in 5 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall first build on 1871-wp-67-function-load_plugin_textdomain-was-called-incorrectly at 51.59%

Changes Missing Coverage Covered Lines Changed/Added Lines %
inc/class-upgrade.php 0 2 0.0%
inc/options/class-wpseo-option-titles.php 29 31 93.55%
src/helpers/options-helper.php 0 4 0.0%
src/integrations/admin/initial-option-setup-integration.php 31 37 83.78%
Totals Coverage Status
Change from base Build ec7d5157d74f2692a5b361b7ecc4597e790502c1: 51.6%
Covered Lines: 16438
Relevant Lines: 31863

💛 - Coveralls

@leonidasmi leonidasmi force-pushed the 1871-wp-67-function-load_plugin_textdomain-was-called-incorrectly branch from 8eff80d to 34369c8 Compare October 22, 2024 10:28
@leonidasmi leonidasmi changed the base branch from trunk to release/23.8 October 22, 2024 10:28
@leonidasmi leonidasmi closed this Oct 25, 2024
@leonidasmi
Copy link
Contributor Author

Closing this in favor of an alternative approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants