WordPress.org

Make WordPress Core

Ticket #36369: 36369.2.diff

File 36369.2.diff, 1.5 KB (added by pento, 11 months ago)
  • src/wp-includes/formatting.php

    diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php
    index e2c8aef269..040fc0a8f5 100644
    a b function esc_url( $url, $protocols = null, $_context = 'display' ) { 
    42024202                return $url;
    42034203        }
    42044204
    4205         $url = str_replace( ' ', '%20', $url );
     4205        $url = str_replace( ' ', '%20', ltrim( $url ) );
    42064206        $url = preg_replace( '|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\[\]\\x80-\\xff]|i', '', $url );
    42074207
    42084208        if ( '' === $url ) {
  • tests/phpunit/tests/formatting/EscUrl.php

    diff --git a/tests/phpunit/tests/formatting/EscUrl.php b/tests/phpunit/tests/formatting/EscUrl.php
    index 96698c19e8..9532976ce2 100644
    a b class Tests_Formatting_EscUrl extends WP_UnitTestCase { 
    1313                $this->assertEquals( 'http://example.com/Mr%20WordPress', esc_url( 'http://example.com/Mr%20WordPress' ) );
    1414                $this->assertEquals( 'http://example.com/Mr%20%20WordPress', esc_url( 'http://example.com/Mr%20%20WordPress' ) );
    1515                $this->assertEquals( 'http://example.com/Mr+WordPress', esc_url( 'http://example.com/Mr+WordPress' ) );
     16                $this->assertEquals( 'http://example.com/Mr+WordPress', esc_url( ' http://example.com/Mr+WordPress' ) );
    1617
    1718                $this->assertEquals( 'http://example.com/?foo=one%20two%20three&bar=four', esc_url( 'http://example.com/?foo=one two three&bar=four' ) );
    1819                $this->assertEquals( 'http://example.com/?foo=one%20two%20three&bar=four', esc_url( 'http://example.com/?foo=one%20two%20three&bar=four' ) );