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

Safeguard array in WP_Job_Manager_Settings::input_capabilities #2631

Merged
merged 2 commits into from
Nov 10, 2023

Conversation

thedebian
Copy link
Contributor

@thedebian thedebian commented Nov 8, 2023

Fixes #2625

Changes Proposed in this Pull Request

This PR adds safeguard in input_capabilities to avoid invalid capabilities to be passed to get_capabilities_and_roles.
It also adds data type safeguard in get_capabilities_and_roles in order to avoid invalid array access.
Lastly, it also updates yoast/phpunit-polyfills in composer.json/lock in order to make the tests compatible with the latest PHPUnit version.

Testing Instructions

  • Install the test suite as described in tests/README.md
  • Run isolated test vendor/bin/phpunit --filter WP_Test_WP_Job_Manager_Settings
  • ✅ The test should pass
  • Also run full test suite vendor/bin/phpunit
  • ✅ All tests should pass
  • Go to the settings page wp-admin/edit.php?post_type=job_listing&page=job-manager-settings#settings-general
  • ✅ Make sure the settings are still displayed properly and that no new errors appear in the logs

Plugin build for eb532dc
📦 Download plugin zip
▶️ Open in playground

@thedebian thedebian added [Type] Bug [Pri] Normal Customer Report Issues or PRs that were reported via Happiness. Previously known as "Happiness Request". labels Nov 8, 2023
@thedebian thedebian requested a review from a team November 8, 2023 14:50
@thedebian thedebian self-assigned this Nov 8, 2023
@thedebian thedebian linked an issue Nov 8, 2023 that may be closed by this pull request
@yscik yscik added this to the 2.0.0 milestone Nov 9, 2023
Copy link
Member

@fjorgemota fjorgemota 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 and works well!

@thedebian thedebian merged commit 5242b39 into trunk Nov 10, 2023
8 checks passed
@thedebian thedebian deleted the fix/2625-input-capabilities-safeguard branch November 10, 2023 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Customer Report Issues or PRs that were reported via Happiness. Previously known as "Happiness Request". [Pri] Normal [Type] Bug
Projects
None yet
3 participants