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

Add check for post_types key #33179 #33180

Merged
merged 2 commits into from May 30, 2022
Merged

Add check for post_types key #33179 #33180

merged 2 commits into from May 30, 2022

Conversation

gigitux
Copy link
Contributor

@gigitux gigitux commented May 24, 2022

This PR adds a check to be sure that we are checking an array. In this way, we can avoid a PHP warning.

All Submissions:

Changes proposed in this Pull Request:

Closes #33179.

How to test the changes in this Pull Request:

Check out this branch.

  1. Install and active Quadrat theme.
  2. Go on the page for adding a product (/wp-admin/post-new.php?post_type=product)
  3. Be sure that it is not raised the warning: Warning: in_array() expects parameter 2 to be array, null given in /plugins/woocommerce/includes/admin/class-wc-admin-meta-boxes.php on line 279

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully run tests with your changes locally?
  • Have you created a changelog file for each project being changed, ie pnpm nx changelog <project>?

FOR PR REVIEWER ONLY:

  • I have reviewed that everything is sanitized/escaped appropriately for any SQL or XSS injection possibilities. I made sure Linting is not ignored or disabled.

@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label May 24, 2022
Add check for post_types key
@botwoo
Copy link
Collaborator

botwoo commented May 24, 2022

📊 Test reports for this pull request have been published and are accessible through the following links:

Latest commit referenced in the reports: add changelog a59a23d
This comment will automatically be updated with the latest referenced commit when you push new changes to this pull request.


Visit the WooCommerce Test Reports homepage to view all published reports. See the FAQs page if you're having problems accessing them.

@Aljullu Aljullu requested review from a team and vedanshujain and removed request for a team May 30, 2022 12:39
@Aljullu
Copy link
Contributor

Aljullu commented May 30, 2022

Sorry for the short notice, @vedanshujain, but will you have some spare cycles to review this PR soon? We would like to request a Code Freeze Exception once it's approved if we still have time to get it included in WC core 6.6. There have been some reports about this fatal in the forums and the fix seems very safe and unlikely to cause regressions.

cc @jonathansadowski

@jonathansadowski jonathansadowski requested review from a team and jorgeatorres and removed request for vedanshujain and a team May 30, 2022 14:38
Copy link
Member

@barryhughes barryhughes 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, guards against errors when $block_template is null (and if it is a WP_Error instance). Left a question regarding changelog, otherwise seems great!

@gigitux
Copy link
Contributor Author

gigitux commented May 30, 2022

Thanks for the review!

I updated the PR (a59a23d) adding the changelog. Hope that it is fine 👍

@barryhughes barryhughes merged commit 9a4f1d9 into trunk May 30, 2022
@barryhughes barryhughes deleted the fix/33179-check-type branch May 30, 2022 18:30
@github-actions github-actions bot added this to the 6.7.0 milestone May 30, 2022
@github-actions
Copy link
Contributor

Hi @barryhughes, thanks for merging this pull request. Please take a look at these follow-up tasks you may need to perform:

  • Add the release: add testing instructions label

@jonathansadowski jonathansadowski modified the milestones: 6.7.0, 6.6.0 May 30, 2022
@jonathansadowski jonathansadowski added the release: cherry-pick Commits from this PR also needs to be added to current release branch. label May 30, 2022
jonathansadowski added a commit that referenced this pull request Jun 3, 2022
* Update required WP version

See https://github.com/woocommerce/woocommerce/blob/trunk/plugins/woocommerce/composer.json#L17

* Add check for post_types key #33179

Add check for post_types key

* add changelog

* Update changelog and readme for cherry-picked PR #33180

* Remove changelog file for cherry-picked PR #33180

* Update version to 6.6.0-rc.2 in woocommerce.php

* Add woo install timestamp to server experimental assignment requests

* Add changelog entry

* Update changelog and readme for cherry-picked PR #33300

* Remove changelog file for cherry-picked PR #33300

Co-authored-by: Viktor Szépe <viktor@szepe.net>
Co-authored-by: Luigi <gigitux@gmail.com>
Co-authored-by: Joshua Flowers <joshuatf@gmail.com>
jonathansadowski added a commit that referenced this pull request Jun 3, 2022
* Remove changelog file for cherry-picked PR #33180

* Remove changelog file for cherry-picked PR #33300
@jonathansadowski jonathansadowski removed the release: cherry-pick Commits from this PR also needs to be added to current release branch. label Jun 3, 2022
@jonathansadowski
Copy link
Contributor

This has been cherry-picked into the release branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin: woocommerce Issues related to the WooCommerce Core plugin.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Argument #2 ($haystack) must be of type array, null given
5 participants