Canonical: When removing trailing punctuation from query string arguments, match the whole query var name.

Props daveslaughter.
Fixes #49347.
Built from https://develop.svn.wordpress.org/trunk@47169


git-svn-id: http://core.svn.wordpress.org/trunk@46969 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-02-03 00:14:07 +00:00
parent bfc5248126
commit 982a6453c9
2 changed files with 2 additions and 2 deletions

View File

@ -485,7 +485,7 @@ function redirect_canonical( $requested_url = null, $do_redirect = true ) {
if ( ! empty( $redirect['query'] ) ) {
// Remove trailing spaces and end punctuation from certain terminating query string args.
$redirect['query'] = preg_replace( "#((p|page_id|cat|tag)=[^&]*?)($punctuation_pattern)+$#", '$1', $redirect['query'] );
$redirect['query'] = preg_replace( "#((^|&)(p|page_id|cat|tag)=[^&]*?)($punctuation_pattern)+$#", '$1', $redirect['query'] );
// Clean up empty query strings.
$redirect['query'] = trim( preg_replace( '#(^|&)(p|page_id|cat|tag)=?(&|$)#', '&', $redirect['query'] ), '&' );

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.4-alpha-47168';
$wp_version = '5.4-alpha-47169';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.