Make WordPress Core


Ignore:
Timestamp:
02/21/2023 01:47:57 AM (22 months ago)
Author:
peterwilsoncc
Message:

HTTP API: Add fragment support to WP_Http::make_absolute_url().

Modifies WP_Http::make_absolute_url() to prevent it from dropping URL fragments, this in turn fixes the same issue for links_add_base_url().

Props costdev, sergeybiryukov, dshanske, schlessera, jrf, desrosj, dd32.
Fixes #56231.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/http/http.php

    r55029 r55370  
    1010
    1111    /**
     12     * @ticket 20434
     13     * @ticket 56231
     14     *
    1215     * @dataProvider make_absolute_url_testcases
    1316     *
     
    6770            // Schemeless URL's (not valid in HTTP Headers, but may be used elsewhere).
    6871            array( '//example.com/sub/', 'https://example.net', 'https://example.com/sub/' ),
     72
     73            // URLs with fragments.
     74            array( '/path#frag', 'http://example.org/', 'http://example.org/path#frag' ),
     75            array( '/path/#frag', 'http://example.org/', 'http://example.org/path/#frag' ),
     76            array( '/path#frag&ment=1', 'http://example.org/', 'http://example.org/path#frag&ment=1' ),
     77            array( '/path?query=string#frag', 'http://example.org/', 'http://example.org/path?query=string#frag' ),
     78            array( '/path?query=string%23frag', 'http://example.org/', 'http://example.org/path?query=string%23frag' ),
    6979        );
    7080    }
Note: See TracChangeset for help on using the changeset viewer.