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 deprecated PHP error in WooCommerce Square plugin #304

Draft
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

mukeshpanchal27
Copy link
Member

@mukeshpanchal27 mukeshpanchal27 commented Mar 12, 2025

All Submissions:

  • Does your code follow the WooCommerce Sniffs variant of WordPress coding standards?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully run tests with your changes locally?
  • Will this change require new documentation or changes to existing documentation?

Changes proposed in this Pull Request:

Closes #270

Steps to test the changes in this Pull Request:

  1. Enable the WooCommerce Square plugin.
  2. Monitor the Query Monitor for PHP errors.

Changelog entry

Fix - Deprecated PHP error for Gift Cards.

@dkotter dkotter requested a review from ankitguptaindia March 12, 2025 14:05
@dkotter dkotter added needs: UAT The Issue/PR needs to go through UAT and removed status: e2e tests failing labels Mar 12, 2025
@qasumitbagthariya
Copy link
Contributor

QA Update: ❌

@mukeshpanchal27

While testing, I noticed the following PHP Deprecated errors. Could you please check from your end?

Please take a look at the attached video for reference.

Screen.Recording.2025-03-18.at.2.50.17.PM.1.mov
[18-Mar-2025 09:21:39 UTC] PHP Deprecated:  Creation of dynamic property Automattic\WooCommerce\Admin\Overrides\Order::$payment_total is deprecated in /Users/sumitbagthariya/Local Sites/square/app/public/wp-content/plugins/woocommerce-square/includes/Framework/PaymentGateway/Payment_Gateway.php on line 1635
[18-Mar-2025 09:21:39 UTC] PHP Deprecated:  Creation of dynamic property Automattic\WooCommerce\Admin\Overrides\Order::$payment is deprecated in /Users/sumitbagthariya/Local Sites/square/app/public/wp-content/plugins/woocommerce-square/includes/Framework/PaymentGateway/Payment_Gateway.php on line 1646
[18-Mar-2025 09:21:39 UTC] PHP Deprecated:  Creation of dynamic property Automattic\WooCommerce\Admin\Overrides\Order::$description is deprecated in /Users/sumitbagthariya/Local Sites/square/app/public/wp-content/plugins/woocommerce-square/includes/Framework/PaymentGateway/Payment_Gateway.php on line 1652
[18-Mar-2025 09:21:39 UTC] PHP Deprecated:  Creation of dynamic property Automattic\WooCommerce\Admin\Overrides\Order::$unique_transaction_ref is deprecated in /Users/sumitbagthariya/Local Sites/square/app/public/wp-content/plugins/woocommerce-square/includes/Gateway.php on line 1138
[18-Mar-2025 09:21:39 UTC] PHP Deprecated:  Creation of dynamic property Automattic\WooCommerce\Admin\Overrides\Order::$square_customer_id is deprecated in /Users/sumitbagthariya/Local Sites/square/app/public/wp-content/plugins/woocommerce-square/includes/Gateway.php on line 344
[18-Mar-2025 09:21:39 UTC] PHP Deprecated:  Creation of dynamic property Automattic\WooCommerce\Admin\Overrides\Order::$square_order_id is deprecated in /Users/sumitbagthariya/Local Sites/square/app/public/wp-content/plugins/woocommerce-square/includes/Gateway.php on line 345
[18-Mar-2025 09:21:39 UTC] PHP Deprecated:  Creation of dynamic property Automattic\WooCommerce\Admin\Overrides\Order::$square_version is deprecated in /Users/sumitbagthariya/Local Sites/square/app/public/wp-content/plugins/woocommerce-square/includes/Gateway.php on line 346

Testing Environment

  • WordPress version: 6.7.1
  • PHP version: 8.2.23
  • WooCommerce Square version: 4.8.7
  • Square Branch - ix/270

@qasumitbagthariya qasumitbagthariya self-requested a review March 18, 2025 10:21
@mukeshpanchal27
Copy link
Member Author

mukeshpanchal27 commented Mar 18, 2025

Thanks, @qasumitbagthariya, for testing.

I reviewed the new PHP deprecations you listed in #304 (comment) and found that all of them are related to the WooCommerce order class properties.

@dkotter, do we need a separate issue to track this, or can we address it in the same PR?

@dkotter
Copy link
Contributor

dkotter commented Mar 18, 2025

Thanks, @qasumitbagthariya, for testing.

I reviewed the new PHP deprecations you listed in #304 (comment) and found that all of them are related to the WooCommerce order class properties.

@dkotter, do we need a separate issue to track this, or can we address it in the same PR?

I believe those deprecation notices are the same that are already reported here: #219

We've already taken a couple approaches to solving that (see #20 and #222) and we ended up closing both of those PRs due to feedback from the Woo team. Ultimately we decided to not make any changes for now.

So if these deprecation notices are the same as previously reported, we don't need to solve those here and unless something has changed, those probably aren't actionable at all.

@mukeshpanchal27
Copy link
Member Author

So if these deprecation notices are the same as previously reported, we don't need to solve those here and unless something has changed, those probably aren't actionable at all.

It was previously reported in PR #20.

What’s the next step? The reported issue for the gift card has been resolved, so should we proceed with moving it to QA/Woo review?

@mukeshpanchal27
Copy link
Member Author

@qasumitbagthariya, could you please retest the errors we are addressing in this PR?

As mentioned in the above comment, those specific errors are already known and can be skipped for now. Please review and move this forward so we can proceed with merging the PR.

@qasumitbagthariya
Copy link
Contributor

qasumitbagthariya commented Mar 20, 2025

QA Update: ✅

I have verified this PR in the fix/270 branch which has been fixed and is functioning as intended.

I tested the following on this branch:

  • Deprecated PHP errors
Screen.Recording.2025-03-20.at.2.09.05.PM.mov

Testing Environment

  • WordPress: 6.7.2
  • Theme: Twenty Twenty-Four 1.3
  • WooCommerce - 9.7.1
  • PHP: 8.0.30
  • Web Server: Nginx 1.20.2
  • Browser: Chrome
  • OS: macOS 15.2
  • Branch: fix/270

Steps to Test- As mentioned in the PR description.
Test Results - It is working as expected.
Functional Demo / Screencast -
Special Notes - Ready for code review (Woo)
Testing Document status:
Cases related to this Issue/PR are added to the Critical Flow Wiki pages:

  • Yes
  • Not Required/Applicable for this PR

@jeffpaul jeffpaul added this to the Future Release milestone Mar 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: UAT The Issue/PR needs to go through UAT status: e2e tests passing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecated PHP Error in WooCommerce Square Plugin
4 participants