Make WordPress Core

Opened 8 months ago

Last modified 13 days 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 (3)

#1 @saemideluxe
8 months ago

Running on PHP8.1

#2 @saemideluxe
8 months ago

Was introduced in commit #a41c798835f620b8fd0a8890b028240ae1a48383

https://github.com/WordPress/WordPress/commit/a41c798835f620b8fd0a8890b028240ae1a48383

#3 @olasenioluwunmi
13 days 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?

Note: See TracTickets for help on using tickets.