Make WordPress Core

Opened 14 months ago

Last modified 6 months ago

#58017 new defect (bug)

Exception thrown when using array-data in URL query

Reported by: saemideluxe's profile 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)

#1 @saemideluxe
14 months ago

Running on PHP8.1

#3 @olasenioluwunmi
6 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 @saemideluxe
6 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.

Last edited 6 months ago by saemideluxe (previous) (diff)
Note: See TracTickets for help on using tickets.