Make WordPress Core

Ticket #16859: square-bracket-esc_url.diff

File square-bracket-esc_url.diff, 548 bytes (added by westi, 12 years ago)

Simple fix to just encode square brackets in esc_url - breaks IPv6 urls though.

  • wp-includes/formatting.php

     
    25482548
    25492549        if ( '' == $url )
    25502550                return $url;
     2551
     2552        // Encode Square brackets into the allowable form
     2553        $url = str_replace( array( '[',']' ), array( '%5B','%5D' ), $url );
    25512554        $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url);
    25522555        $strip = array('%0d', '%0a', '%0D', '%0A');
    25532556        $url = _deep_replace($strip, $url);