Make WordPress Core

Changeset 45578


Ignore:
Timestamp:
07/01/2019 03:28:21 AM (5 years ago)
Author:
pento
Message:

Formatting: Trim leading whitespace in esc_url().

Props toszcze.
Fixes #36369.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/formatting.php

    r45577 r45578  
    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
  • trunk/tests/phpunit/tests/formatting/EscUrl.php

    r43571 r45578  
    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' ) );
Note: See TracChangeset for help on using the changeset viewer.