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 deprecation warnings with PHP 8.2. #2701

Merged
merged 3 commits into from
Mar 11, 2024
Merged

Conversation

rawdreeg
Copy link
Contributor

Changes proposed in this Pull Request:

Fixes deprecation warnings with PHP 8.2 and above.

Closes #2635.

  • Do the changed files pass phpcs checks? Please remove phpcs:ignore comments in changed files and fix any issues, or delete if not practical.

Detailed test instructions:

  1. Enable debug and debug logging.
  2. Activate and connect Facebook for WooCommerce
  3. Navigate to Marketing > Facebook for WooCommerce. There should be no deprecation warnings.
  4. Navigate to Tools > Scheduled Actions
  5. Run the Pending wc_facebook_regenerate_feed action. There should be no deprecation warnings.

Changelog entry

Fix - Deprecation warnings with PHP 8.2.

@rawdreeg rawdreeg requested a review from a team March 11, 2024 07:49
@rawdreeg rawdreeg self-assigned this Mar 11, 2024
@github-actions github-actions bot added changelog: fix Took care of something that wasn't working. type: bug The issue is a confirmed bug. labels Mar 11, 2024
@rawdreeg rawdreeg added priority: high The issue/PR is high priority—it affects lots of customers substantially, but not critically. and removed type: bug The issue is a confirmed bug. changelog: fix Took care of something that wasn't working. labels Mar 11, 2024
@message-dimke message-dimke requested review from message-dimke and removed request for a team March 11, 2024 07:50
@message-dimke
Copy link
Contributor

I did some small research and when the changes in the PR are legit, I have a few questions:

https://github.com/woocommerce/facebook-for-woocommerce/blob/0ca17f88786cbb9180875d204058b65daf48d1f8/facebook-commerce.php#L1690-L1699

These lines do two things:

  • First, they introduce another dynamic property, fbproductfeed.
  • Second, this is the only place where WC_Facebook_Product_Feed is called with parameters.

My guess is, if looking at https://github.com/woocommerce/facebook-for-woocommerce/blob/0ca17f88786cbb9180875d204058b65daf48d1f8/includes/fbproductfeed.php#L44-L47, neither facebook_catalog_id nor feed_id are used anywhere. Search through the whole project did not provide any results. I believe we could remove those properties and even the constructor, unless there is a bug and we do need those properties somewhere.

@rawdreeg
Copy link
Contributor Author

Your guess is right. These can be removed -- probably. these properties are set or accessed. I just didn't want to remove them without testing as I wasn't sure if I had missed anything

@rawdreeg
Copy link
Contributor Author

@message-dimke I removed the unused constructor. 28a6844

@rawdreeg rawdreeg requested a review from message-dimke March 11, 2024 20:27
Copy link
Contributor

@message-dimke message-dimke 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, @rawdreeg !

@rawdreeg rawdreeg merged commit 5f867a1 into develop Mar 11, 2024
6 checks passed
@rawdreeg rawdreeg deleted the fix/deprecation-notices-php82 branch March 11, 2024 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: high The issue/PR is high priority—it affects lots of customers substantially, but not critically.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecated warnings with PHP 8.2
2 participants