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

Prevent possible type error during WC_Install::create_options() #45730

Merged
merged 3 commits into from Mar 20, 2024

Conversation

jorgeatorres
Copy link
Member

Submission Review Guidelines:

Changes proposed in this Pull Request:

This adds a type cast so that $settings_page->get_sections() always returns an array, which prevents a possible fatal error during install in cases where some code might be misusing the woocommerce_get_sections_<id> filter.

How to test the changes in this Pull Request:

Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:

  1. Add a snippet with the following code to your site:
    <?php
    add_filter( 'woocommerce_get_sections_general', '__return_null' );
  2. We're going to "fake" an update in this conditions:
    wp option update woocommerce_version 8.7.9 &&  wp transient delete wc_installing
    
  3. Open a page on your site to trigger the install routine.
  4. No fatal error should appear.
  5. Confirm WC has been updated by running wp option get woocommerce_version, which should output 8.8.0.
  6. (Optional) Run 2-3 on trunk and verify that a fatal error does occur in that case.

Changelog entry

  • Automatically create a changelog entry from the details below.

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement - Improvement to existing functionality

Message

Comment

@jorgeatorres jorgeatorres requested review from a team and lsinger and removed request for a team March 20, 2024 00:51
@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Mar 20, 2024
Copy link
Contributor

Hi @lsinger,

Apart from reviewing the code changes, please make sure to review the testing instructions as well.

You can follow this guide to find out what good testing instructions should look like:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

Copy link
Contributor

github-actions bot commented Mar 20, 2024

Test Results Summary

Commit SHA: 572ee39

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests25900202610m 38s
E2E Tests680028903578m 16s

To view the full API test report, click here.
To view the full E2E test report, click here.
To view all test reports, visit the WooCommerce Test Reports Dashboard.

Copy link
Contributor

@lsinger lsinger left a comment

Choose a reason for hiding this comment

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

Change looks good to me. Added a documentation block for the filter to appease the linter. Good to go once CI checks pass. 🚢

@lsinger lsinger enabled auto-merge (squash) March 20, 2024 10:48
@lsinger lsinger merged commit 4ce5bb5 into trunk Mar 20, 2024
33 of 35 checks passed
@lsinger lsinger deleted the fix/type-error-create-options branch March 20, 2024 13:12
@github-actions github-actions bot added this to the 8.8.0 milestone Mar 20, 2024
@github-actions github-actions bot added the needs: analysis Indicates if the PR requires a PR testing scrub session. label Mar 20, 2024
@alopezari alopezari added needs: internal testing Indicates if the PR requires further testing conducted by Solaris status: analysis complete Indicates if a PR has been analysed by Solaris and removed needs: analysis Indicates if the PR requires a PR testing scrub session. labels Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: internal testing Indicates if the PR requires further testing conducted by Solaris plugin: woocommerce Issues related to the WooCommerce Core plugin. status: analysis complete Indicates if a PR has been analysed by Solaris
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants