Opened 22 months ago
Last modified 14 months ago
#58017 new defect (bug)
Exception thrown when using array-data in URL query
Reported by: | saemideluxe | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 6.2 |
Component: | Menus | Keywords: | needs-refresh reporter-feedback |
Focuses: | Cc: |
Description
When using the following URL query:
?mtype=libraryitem&maps-tag%5B0%5D=children
Then the following function:
/wp-includes/blocks/navigation-link.php(129): block_core_navigation_link_maybe_urldecode
will throw the following Error:
Uncaught TypeError: rawurldecode(): Argument #1 ($string) must be of type string, array given
because the function wp_parse_args (that is used in the function above) will parse the given URL to return query-keys ending with []-characters to be an array and not a plain string, see output from print_r:
(
[mtype] => libraryitem
[maps-tag] => Array
(
[0] => children
)
)
But the function rawurldecode that is used below expects the argument to be a string, not an array.
This suddenly started happening, I assume after 6.2 got released on March 29, 2023.
Change History (4)
#2
@
22 months ago
Was introduced in commit #a41c798835f620b8fd0a8890b028240ae1a48383
https://github.com/WordPress/WordPress/commit/a41c798835f620b8fd0a8890b028240ae1a48383
#3
@
14 months ago
- Keywords reporter-feedback added
@saemideluxe I can't replicate this on php 7.4/8.1, versions 6.2/6.5. Can you give more details/context on how to reproduce this?
#4
@
14 months ago
On Wordpress 6.4 with PHP 8.2 the follwing URL goes into the function block_core_navigation_link_maybe_urldecode:
https://example.net/contact/my-category/resource/?tags%5B0%5D=children
This will result in the mentioned exception.
Running on PHP8.1