Make WordPress Core


Ignore:
Timestamp:
07/03/2015 02:27:11 PM (10 years ago)
Author:
jorbin
Message:

Don't strip newline in esc_url() when protocol is mailto:

The mailto protocol is a bit different than the other protocols in that new lines are something you might realistically want to include. Includes tests to make sure that http protocol urls that contain mailto: aren't affected. Tests for stripping newlines in general already exist.

Fixes #31632
Props danielbachhuber

File:
1 edited

Legend:

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

    r33027 r33064  
    31603160        return $url;
    31613161    $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url);
    3162     $strip = array('%0d', '%0a', '%0D', '%0A');
    3163     $url = _deep_replace($strip, $url);
     3162    if ( 0 !== stripos( $url, 'mailto:' ) ) {
     3163        $strip = array('%0d', '%0a', '%0D', '%0A');
     3164        $url = _deep_replace($strip, $url);
     3165    }
    31643166    $url = str_replace(';//', '://', $url);
    31653167    /* If the URL doesn't appear to contain a scheme, we
Note: See TracChangeset for help on using the changeset viewer.