Make WordPress Core

Opened 5 years ago

Last modified 4 years ago

#50279 new defect (bug)

add_query_arg() removes equal sign from assigned value

Reported by: artprojectgroup's profile artprojectgroup Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.4.1
Component: General Keywords: needs-patch
Focuses: Cc:

Description

If you add a query array like this:

<?php
$data =[
    'api_id'            => 'xxxxx==',
    'to'                => 123456,
    'text'              => "Prueba",
];
$url    = add_query_arg( $data , 'https://xxx.com' );

The $url you get is this: https://xxx.com?api_id=xxxxx=&to=123456&text=Prueba

The line 1142:

<?php
$ret = preg_replace( '#=(&|$)#', '$1', $ret );

Gets "xxxxx==" and return "xxxxx=".

Please fix it.

Kind regards.

Change History (1)

#1 @sabernhardt
4 years ago

  • Keywords needs-patch added
  • Summary changed from Issue in add_query_arg function. wp-includes/functions.php - line 1142 to add_query_arg() removes equal sign from assigned value

The example URL keeps the API ID value intact without the preg_replace, but I don't know what might break (for others) without it.

For history, that line was added in [5999] on ticket #4878.

Note: See TracTickets for help on using tickets.