[wp-trac] [WordPress Trac] #44744: Bug on canonical redirect with Hebrew query string.
WordPress Trac
noreply at wordpress.org
Sat Nov 9 10:42:56 UTC 2019
#44744: Bug on canonical redirect with Hebrew query string.
----------------------------------------+-----------------------------
Reporter: yehudah | Owner: SergeyBiryukov
Type: defect (bug) | Status: reviewing
Priority: normal | Milestone: Future Release
Component: Canonical | Version: 4.9.8
Severity: major | Resolution:
Keywords: needs-unit-tests has-patch | Focuses:
----------------------------------------+-----------------------------
Comment (by atanasangelovdev):
I wanted to write a unit test for this but I failed to reproduce the
issue. Here are the URLs I tested with and none of them produce a redirect
($redirect_url is false):
{{{
http://example.org/?שלום
http://example.org/?%D7%A9%D7%9C%D7%95%D7%9D
http://example.org/ticket-44744/?שלום
http://example.org/ticket-44744/?%D7%A9%D7%9C%D7%95%D7%9D
http://example.org/ticket-44744/?foo=שלום
http://example.org/ticket-44744/?foo=%D7%A9%D7%9C%D7%95%D7%9D
}}}
Here's the test class I used:
{{{#!php
class Tests_Canonical_Loop extends WP_Canonical_UnitTestCase {
/**
* @dataProvider data
*/
function test( $test_url, $expected, $ticket = 0,
$expected_doing_it_wrong = array() ) {
$this->assertCanonical( $test_url, $expected, $ticket,
$expected_doing_it_wrong );
}
function data() {
$post_slug = 'ticket-44744';
$post_id = self::factory()->post->create(
array(
'post_type' => 'page',
'post_status' => 'publish',
'post_title' => $post_slug,
'post_name' => $post_slug,
)
);
/* Format:
* [0]: $test_url,
* [1]: expected results: Any of the following can be used
* array( 'url': expected redirection location, 'qv':
expected query vars to be set via the rewrite AND $_GET );
* array( expected query vars to be set, same as 'qv'
above )
* (string) expected redirect location
* [3]: (optional) The ticket the test refers to, Can be
skipped if unknown.
*/
return array(
array( "/?שלום", "/?שלום", 44744 ),
array( "/?%D7%A9%D7%9C%D7%95%D7%9D",
"/?%D7%A9%D7%9C%D7%95%D7%9D", 44744 ),
array( "/{$post_slug}/?שלום",
"/{$post_slug}/?שלום", 44744 ),
array( "/{$post_slug}/?%D7%A9%D7%9C%D7%95%D7%9D",
"/{$post_slug}/?%D7%A9%D7%9C%D7%95%D7%9D", 44744 ),
array( "/{$post_slug}/?foo=שלום",
"/{$post_slug}/?foo=שלום", 44744 ),
array(
"/{$post_slug}/?foo=%D7%A9%D7%9C%D7%95%D7%9D",
"/{$post_slug}/?foo=%D7%A9%D7%9C%D7%95%D7%9D", 44744 ),
);
}
}
}}}
Maybe I've misunderstood the issue?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44744#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list