#49347 closed defect (bug) (fixed)
redirect_canonical() removing trailing punctuation from any query string arg ending in p
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 5.4 | Priority: | normal |
Severity: | normal | Version: | 5.3.2 |
Component: | Canonical | Keywords: | |
Focuses: | Cc: |
Description
To reproduce add any query string with arg name ending p|page_id|cat|tag, and punctuation at the end of the value, e.g. "www.example.com/?comp=East+(North)"
Actual behaviour is to redirect to "www.example.com/?comp=East+(North".
Expected behaviour is to not redirect.
The problem is in the redirect_canonical function, specifically the regex to "Remove trailing spaces and end punctuation from certain terminating query string args.", which is
#(((p|page_id|cat|tag)=[^&]*?)($punctuation_pattern)+$#
The other regexes just after this code limit the query string args by making sure the complete arg name is checked, so the correct regex would be:
#((^|&)(p|page_id|cat|tag)=[^&]*?)($punctuation_pattern)+$#
Attachments (1)
Change History (4)
Note: See
TracTickets for help on using
tickets.
Hi there, welcome to WordPress Trac! Thanks for the report and the patch.
Introduced in [41991].