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

Hooks: add input validation to all methods #573

Merged
merged 1 commit into from
Oct 29, 2021

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Oct 11, 2021

Neither of the methods in the WpOrg\Requests\Hooks class did any input validation. This could lead to various PHP errors and becomes all the more relevant due to the new "passing null to non-nullable" deprecation notice on PHP 8.1.

This commit adds simple input validation to all methods within the WpOrg\Requests\Hooks class and will throw an WpOrg\Requests\Exception\InvalidArgument exception if a parameter does not comply with the expectations.

Includes adding tests for the new exceptions and a test to safeguard that closures are accepted.

Neither of the methods in the `WpOrg\Requests\Hooks` class did any input validation. This could lead to various PHP errors and becomes all the more relevant due to the new "passing null to non-nullable" deprecation notice on PHP 8.1.

This commit adds simple input validation to all methods within the `WpOrg\Requests\Hooks` class and will throw an `WpOrg\Requests\Exception\InvalidArgument` exception if a parameter does not comply with the expectations.

Includes adding tests for the new exceptions and a test to safeguard that closures are accepted
@jrfnl jrfnl added this to the 2.0.0 milestone Oct 11, 2021
@jrfnl jrfnl requested a review from schlessera October 11, 2021 16:00
@schlessera schlessera merged commit 2d600fb into develop Oct 29, 2021
@schlessera schlessera deleted the feature/hooks-add-input-validation branch October 29, 2021 13:08
@jrfnl jrfnl mentioned this pull request Nov 6, 2021
28 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants