Fix PayPal donation URL validation for complex query strings #1151
+83
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fixes #1150 — PayPal donation URLs with complex query strings are now correctly recognized as valid.
The donate link validation incorrectly flagged valid PayPal donation URLs as invalid when they contained URLs in query parameters (e.g.,
return=https://wordpress.org/plugins/my-plugin/).Changes
Updated
is_valid_url()method (includes/Traits/URL_Utils.php):filter_var()validation with a more lenient approach usingwp_parse_url()wp_parse_url()returnsfalseor non-array values?), preventing false positives when URLs appear in query parametersAdded test cases (
tests/phpunit/tests/Traits/URL_Utils_Tests.php):paypal.me,paypal.com/donate, etc.)Added integration test (
tests/phpunit/tests/Checker/Checks/Plugin_Readme_Check_Tests.php):test_run_with_valid_paypal_donate_link()to verify the full check flowtest-plugin-plugin-readme-valid-paypal-donatewith a valid PayPal donation URLBenefits
Checklist