Permalinks: Ignore malformed post type query arrays#11651
Permalinks: Ignore malformed post type query arrays#11651dhrupo wants to merge 2 commits intoWordPress:trunkfrom
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
There was a problem hiding this comment.
Let’s use a single test with a data provider for better coverage, and we can remove the duplicate code.
There was a problem hiding this comment.
Updated in 6b6be36. I collapsed the GET/POST cases into a single provider-backed test and removed the duplicated setup/cleanup code. I also reran npm run test:php -- --filter Tests_WP_ParseRequest and ./vendor/bin/phpcs --standard=phpcs.xml.dist tests/phpunit/tests/wp/parseRequest.php after the refactor.
Trac ticket: https://core.trac.wordpress.org/ticket/65123
Summary
This ignores non-scalar values when sanitizing
post_typequery vars inWP::parse_request(), preventing malformed array input from surfacing PHP warnings during front-end requests.Testing Instructions
/?post_type[][]=page&post_type[]=poston a local site withWP_DEBUG_DISPLAYenabled.npm run test:php -- --filter Tests_WP_ParseRequest.