WordPress.org

Make WordPress Core

Opened 11 months ago

Last modified 5 months ago

#44744 reviewing defect (bug)

Bug on canonical redirect with Hebrew query string.

Reported by: yehudah Owned by: SergeyBiryukov
Milestone: Future Release Priority: normal
Severity: major Version: 4.9.8
Component: Canonical Keywords: needs-unit-tests has-patch
Focuses: Cc:

Description

Hello,

Example URL:
http://domain.com/?שלום

The example comes after having problems with Woocommerce product filters.

Line 491-493 in /wp-includes/canonical.php we have this:

<?php
if ( ! $redirect_url || $redirect_url == $requested_url ) {
        return;
}

The problem:

This will fail because the $redirect_url is not URL safe format and encoded like $requested_url.

Possible solution:

One line before we can use wp_sanitize_redirect function like this:

<?php
$redirect_url = wp_sanitize_redirect( $redirect_url );
if ( ! $redirect_url || $redirect_url == $requested_url ) {
        return;
}

Attachments (1)

44744.diff (430 bytes) - added by rellect 11 months ago.

Download all attachments as: .zip

Change History (12)

#1 @SergeyBiryukov
11 months ago

#44769 was marked as a duplicate.

#2 @SergeyBiryukov
11 months ago

  • Keywords needs-patch needs-unit-tests added
  • Milestone changed from Awaiting Review to Future Release

@rellect
11 months ago

#3 @rellect
11 months ago

  • Keywords needs-patch removed

#4 @SergeyBiryukov
9 months ago

  • Keywords has-patch added
  • Milestone changed from Future Release to 4.9.9
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#5 @pento
9 months ago

  • Milestone changed from 4.9.9 to 5.0.1

#6 @andizer
8 months ago

Wouldn't it be better to use rawurldecode instead of urldecode?

#7 @pento
7 months ago

  • Milestone changed from 5.0.1 to 5.0.2

#8 @pento
6 months ago

  • Milestone changed from 5.0.2 to 5.0.3

#9 @audrasjb
6 months ago

  • Milestone changed from 5.0.3 to 5.1

Hello, and thanks for the ticket and patches,

This ticket still needs some unit-tests.

Since we are looking to retrieve "normal" minor release workflow, let's address this ticket in milestone 5.1.

#10 @pento
5 months ago

  • Milestone changed from 5.1 to Future Release

#11 @pento
5 months ago

#45315 was marked as a duplicate.

Note: See TracTickets for help on using tickets.