[wp-trac] [WordPress Trac] #58017: Exception thrown when using array-data in URL query

WordPress Trac noreply at wordpress.org
Tue Mar 17 06:38:26 UTC 2026


#58017: Exception thrown when using array-data in URL query
--------------------------+--------------------------------
 Reporter:  saemideluxe   |       Owner:  (none)
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  Editor        |     Version:  6.2
 Severity:  normal        |  Resolution:  reported-upstream
 Keywords:                |     Focuses:
--------------------------+--------------------------------
Changes (by sabernhardt):

 * status:  new => closed
 * component:  Menus => Editor
 * milestone:  Awaiting Review =>
 * keywords:  needs-refresh reporter-feedback =>
 * resolution:   => reported-upstream


Old 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.

New 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.

--

Comment:

 Thanks for the report.

 [https://github.com/WordPress/gutenberg/pull/58068 GB58068] fixed this in
 `block_core_navigation_link_maybe_urldecode()` for WordPress 6.5 (merged
 in [https://core.trac.wordpress.org/changeset/57578/trunk/src/wp-
 includes/blocks/navigation-link.php r57578]).

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/58017#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list