Make WordPress Core


Ignore:
Timestamp:
09/05/2015 09:28:50 PM (11 years ago)
Author:
johnbillion
Message:

Bail out early from esc_url() if the URL becomes empty after stripping out disallowed characters.

Fixes #28015
Props jesin for the unit test

File:
1 edited

Legend:

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

    r33858 r33923  
    32783278    $url = str_replace( ' ', '%20', $url );
    32793279    $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url);
     3280
     3281    if ( '' === $url ) {
     3282        return $url;
     3283    }
     3284
    32803285    if ( 0 !== stripos( $url, 'mailto:' ) ) {
    32813286        $strip = array('%0d', '%0a', '%0D', '%0A');
Note: See TracChangeset for help on using the changeset viewer.