Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#30869 closed defect (bug) (duplicate)

Output of esc_url doesn't allow brackets

Reported by: rabmalin Owned by:
Priority: normal Milestone:
Component: Formatting Version: 3.0
Severity: normal Keywords:
Cc: Focuses:

Description

$args = array(
 'autofocus[control]' => 'blogname',
);
$url = add_query_arg( $args, admin_url('customize.php' ));
echo esc_url($url);

Current output:
http://staging.dev/wp-admin/customize.php?autofocuscontrol=blogname

Expected output:
http://staging.dev/wp-admin/customize.php?autofocus[control]=blogname

I was trying to generate auto focus URL for customize page. I generally use esc_url to escape any URL in WordPress. But I could not produce expected URL when URL is escaped with the function. Is this expected feature of the function? Can someone please help make me clear about this?
Thanks.

Attachments (1)

30869.diff (1.3 KB ) - added by valendesigns 12 years ago.

Download all attachments as: .zip

Change History (3)

@valendesigns
12 years ago

#1 @valendesigns
12 years ago

  • Component GeneralFormatting
  • Keywords has-patch dev-feedback added
  • Summary Output of `esc_url`Output of esc_url doesn't allow brackets
  • Version 4.13.0

Here is a patch with unit tests to fix the issue; all other formatting unit tests continue passing. It appears the regex pattern was introduced in #12309 and hasn't changed since.

#2 @dd32
12 years ago

  • Keywords has-patch dev-feedback removed
  • Milestone Awaiting Review
  • Resolutionduplicate
  • Status newclosed

Duplicate of #16859.

Note: See TracTickets for help on using tickets.