Prevent trailing ampersand in some URLs in WordPress
There's a minor flaw in CRM_Utils_System_WordPress::url()
which produces URLs with a trailing &
when an empty array is passed to CRM_Utils_System::url()
as the $query
parameter. See, for example, the call to CRM_Utils_System::url()
in CRM_Core_Payment::getNotifyUrl()
.
The flaw is that $query
is set and is an empty string, which is appended to $queryParts
and then results in a trailing &
when the $queryParts
array is imploded.
My concern is that the URLs generated when an empty array is passed as the $query
param are likely to be caught by redirect_canonical()
with the possible loss of session data as a result of a WordPress-triggered redirect. (Or rather - since the example IPN URL is called externally - others like it in the CiviCRM ecosystem)
PR to follow.