Make WordPress Core


Ignore:
Timestamp:
04/08/2019 01:09:01 AM (6 years ago)
Author:
pento
Message:

Canonical: Ensure redirect query keys are URL encoded.

This prevents an infinite redirect loop when a request containing URL-encoded characters triggers is_404().

Props soulseekah, wrwrwr0.
Fixes #43745.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/canonical.php

    r42343 r45133  
    214214        );
    215215    }
     216
     217    /**
     218     * @ticket 43745
     219     */
     220    public function test_utf8_query_keys_canonical() {
     221        $p = self::factory()->post->create(
     222            array(
     223                'post_type' => 'page',
     224            )
     225        );
     226        update_option( 'show_on_front', 'page' );
     227        update_option( 'page_on_front', $p );
     228
     229        $this->go_to( get_permalink( $p ) );
     230
     231        $url = redirect_canonical( add_query_arg( '%D0%BA%D0%BE%D0%BA%D0%BE%D0%BA%D0%BE', 1, site_url( '/' ) ), false );
     232        $this->assertNull( $url );
     233
     234        delete_option( 'page_on_front' );
     235    }
    216236}
Note: See TracChangeset for help on using the changeset viewer.