Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#30869 closed defect (bug) (duplicate)

Output of esc_url doesn't allow brackets

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


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

Current output:

Expected output:[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?

Attachments (1)

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

Download all attachments as: .zip

Change History (3)

8 years ago

#1 @valendesigns
8 years ago

  • Component changed from General to Formatting
  • Keywords has-patch dev-feedback added
  • Summary changed from Output of `esc_url` to Output of esc_url doesn't allow brackets
  • Version changed from 4.1 to 3.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
8 years ago

  • Keywords has-patch dev-feedback removed
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #16859.

Note: See TracTickets for help on using tickets.