WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/23/2015 05:56:25 AM (5 years ago)
Author:
dd32
Message:

Use wp_parse_url() in esc_url() to avoid parsing bugs in < PHP 5.4.7.

Props johnbillion for unit tests
See #34408
Fixes #34202

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/formatting/EscUrl.php

    r34920 r35370  
    211211    }
    212212
     213    /**
     214     * @ticket 34202
     215     */
     216    function test_ipv6_hosts() {
     217        $this->assertEquals( '//[::127.0.0.1]', esc_url( '//[::127.0.0.1]' ) );
     218        $this->assertEquals( 'http://[::FFFF::127.0.0.1]', esc_url( 'http://[::FFFF::127.0.0.1]' ) );
     219        $this->assertEquals( 'http://[::127.0.0.1]', esc_url( 'http://[::127.0.0.1]' ) );
     220        $this->assertEquals( 'http://[::DEAD:BEEF:DEAD:BEEF:DEAD:BEEF:DEAD:BEEF]', esc_url( 'http://[::DEAD:BEEF:DEAD:BEEF:DEAD:BEEF:DEAD:BEEF]' ) );
     221
     222        // IPv6 with square brackets in the query? Why not.
     223        $this->assertEquals( '//[::FFFF::127.0.0.1]/?foo%5Bbar%5D=baz', esc_url( '//[::FFFF::127.0.0.1]/?foo[bar]=baz' ) );
     224        $this->assertEquals( 'http://[::FFFF::127.0.0.1]/?foo%5Bbar%5D=baz', esc_url( 'http://[::FFFF::127.0.0.1]/?foo[bar]=baz' ) );
     225    }
     226
    213227}
Note: See TracChangeset for help on using the changeset viewer.