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

Fix: Suppress deprecated warning when applying a coupon on Cart in PHP > 8.0 #45981

Merged
merged 5 commits into from Mar 27, 2024

Conversation

wavvves
Copy link
Contributor

@wavvves wavvves commented Mar 27, 2024

Submission Review Guidelines:

Changes proposed in this Pull Request:

New changes on #43872 introduced a deprecated warning when attempting to run strlen on a null string (billing_email in this case, which is not supplied in cart)
This PR adds a new check to prevent that, and also adds the string $error_message property to class WC_Coupon to prevent another warning on the same class.

Closes #45956 .

How to test the changes in this Pull Request:

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

  1. Install and activate the extension Debug Log Manager
  2. Add a non-existent coupon on Shortcode Cart
  3. Error log on /wp-admin/tools.php?page=debug-log-manager should not contain deprecated warnings stating Deprecated: strlen(): Passing null to parameter or related to creation of a dynamic property called error_message

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

Fix: Suppress deprecated warning when applying a coupon on Cart in PHP > 8.0

@wavvves wavvves self-assigned this Mar 27, 2024
@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Mar 27, 2024
@wavvves wavvves requested a review from nielslange March 27, 2024 10:23
@woocommercebot woocommercebot requested a review from a team March 27, 2024 10:23
Copy link
Contributor

github-actions bot commented Mar 27, 2024

Hi @nielslange,

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

@wavvves wavvves added type: bug The issue is a confirmed bug. team: Rubik Store API checkout endpoints, Mini-Cart, Cart and Checkout related issues focus: coupon Issues related to coupons. labels Mar 27, 2024
@wavvves wavvves marked this pull request as draft March 27, 2024 10:34
@wavvves wavvves marked this pull request as ready for review March 27, 2024 10:34
Copy link
Contributor

github-actions bot commented Mar 27, 2024

Test Results Summary

Commit SHA: e3d2668

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests25900202610m 39s
E2E Tests780031303917m 46s

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
Member

@alexflorisca alexflorisca left a comment

Choose a reason for hiding this comment

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

Looks good 👍

@wavvves wavvves merged commit 7c75791 into trunk Mar 27, 2024
25 checks passed
@wavvves wavvves deleted the fix/45956-applying-coupons-in-generates-php-deprecated branch March 27, 2024 16:27
@github-actions github-actions bot added this to the 8.9.0 milestone Mar 27, 2024
@github-actions github-actions bot added the needs: analysis Indicates if the PR requires a PR testing scrub session. label Mar 27, 2024
@Danielspain22
Copy link

Hi' i've submitted the related #45956, will this fix be applied to the final 8.8 release???(i'm seeing the fix added to 8.9 milestone, but the issue i've found affects the upcoming 8.8 right now)

@wavvves
Copy link
Contributor Author

wavvves commented Mar 27, 2024

Hi' i've submitted the related #45956, will this fix be applied to the final 8.8 release???(i'm seeing the fix added to 8.9 milestone, but the issue i've found affects the upcoming 8.8 right now)

Hi @Danielspain22, we're still evaluating impact to determine the version of WC this will ship in. The PR will be updated once more information is available

@alopezari alopezari 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 Mar 27, 2024
@Stojdza Stojdza modified the milestones: 8.9.0, 8.8.0 Mar 28, 2024
github-actions bot pushed a commit that referenced this pull request Mar 28, 2024
…P > 8.0 (#45981)

* Fix deprecated warning when applying a coupon on Cart in PHP > 8.0

* Add changefile(s) from automation for the following project(s): woocommerce

* Changed property type to protected

---------

Co-authored-by: github-actions <github-actions@github.com>
Stojdza pushed a commit that referenced this pull request Mar 28, 2024
* Fix: Suppress deprecated warning when applying a coupon on Cart in PHP > 8.0 (#45981)

* Fix deprecated warning when applying a coupon on Cart in PHP > 8.0

* Add changefile(s) from automation for the following project(s): woocommerce

* Changed property type to protected

---------

Co-authored-by: github-actions <github-actions@github.com>

* Prep for cherry pick 45981

---------

Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: WooCommerce Bot <no-reply@woo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus: coupon Issues related to coupons. 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 team: Rubik Store API checkout endpoints, Mini-Cart, Cart and Checkout related issues type: bug The issue is a confirmed bug.
Projects
None yet
5 participants