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

Session handler: restore use of _table property, for consistency with other methods. #44517

Merged
merged 2 commits into from Feb 15, 2024

Conversation

barryhughes
Copy link
Member

Submission Review Guidelines:

Changes proposed in this Pull Request:

WC_Session_Handler uses its _table property to store a reference to the woocommerce_sessions database table.

At one point, all methods within the class used this property to refer to the table, and that meant subclasses could change the target database table quite easily. This was apparently broken by mistake in #21455, which hard-coded the table name within one method.

This change restores the use of _table across the class. Functionally, nothing actually changes: it just makes it easier for third parties to implement certain types of customization (and also makes things more consistent than previously).

I did not add a unit test, because the class depends on the cookies superglobal and it felt cleaner to infer it is operating successfully via our existing battery of storefront, cart and checkout E2E tests.

Closes #28193.

How to test the changes in this Pull Request:

You should experience the same behavior with or without this change (we are verifying nothing has changed or broken, rather than looking for a difference):

  1. Login as a known shopper.
  2. Add an item to the cart.
  3. Open a new browsing session (this could mean using a different browser, an incognito or private browsing session, or a fresh container if you use Firefox).
  4. Login as the same shopper.
  5. You should find the cart is populated with the same item you added in the first browsing session: this indicates that session data is continuing to work correctly with this change in place.
Two separate browser sessions, showing the same cart contents for the same authenticated shopper.

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

@barryhughes barryhughes requested review from a team and jorgeatorres and removed request for a team February 9, 2024 17:23
@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Feb 9, 2024
Copy link
Contributor

github-actions bot commented Feb 9, 2024

Hi @jorgeatorres,

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 Feb 9, 2024

Test Results Summary

Commit SHA: 3eb039d

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests25900202610m 36s
E2E Tests1690014803173m 52s

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.

@jorgeatorres jorgeatorres enabled auto-merge (squash) February 15, 2024 03:22
Copy link
Member

@jorgeatorres jorgeatorres left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you @barryhughes!

@jorgeatorres jorgeatorres merged commit 94c0578 into trunk Feb 15, 2024
34 checks passed
@jorgeatorres jorgeatorres deleted the fix/28913-session-table-property branch February 15, 2024 03:22
@github-actions github-actions bot added this to the 8.7.0 milestone Feb 15, 2024
@github-actions github-actions bot added the needs: analysis Indicates if the PR requires a PR testing scrub session. label Feb 15, 2024
@Stojdza Stojdza added needs: external testing Indicates if the PR requires further testing conducted by testers external to the development team. 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 Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: external testing Indicates if the PR requires further testing conducted by testers external to the development team. 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.

Regression: hard-coded database table in WC_Session_Handler
3 participants