Make WordPress Core


Ignore:
Timestamp:
02/21/2026 04:40:18 AM (7 months ago)
Author:
westonruter
Message:

XML-RPC: Account for parsed server URLs that do not specify host or scheme.

Developed in https://github.com/WordPress/wordpress-develop/pull/10916

Props bluefuton, tfrommen, chrispecoraro, drebbits.web, westonruter.
Fixes #64635, #40784.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/xmlrpc/client.php

    r56536 r61713  
    1919
    2020        /**
     21         * @ticket 64635
     22         */
     23        public function test_ixr_client_can_handle_missing_host() {
     24                $client = new IXR_Client( '/no-host-here' );
     25                $this->assertSame( '', $client->server );
     26        }
     27
     28        /**
    2129         * @ticket 26947
    2230         */
     
    2735                $this->assertSame( '/server.php?this-is-needed=true', $client->path );
    2836        }
     37
     38        /**
     39         * @ticket 40784
     40         */
     41        public function test_wp_ixr_client_can_handle_protocolless_urls() {
     42                $client = new WP_HTTP_IXR_Client( '//example.com/server.php' );
     43                $this->assertSame( '', $client->scheme );
     44                $this->assertSame( 'example.com', $client->server );
     45        }
     46
     47        /**
     48         * @ticket 40784
     49         */
     50        public function test_wp_ixr_client_can_handle_relative_urls() {
     51                $client = new WP_HTTP_IXR_Client( '/server.php' );
     52                $this->assertSame( '', $client->scheme );
     53                $this->assertSame( '', $client->server );
     54                $this->assertSame( '/server.php', $client->path );
     55        }
     56
     57        /**
     58         * @ticket 40784
     59         */
     60        public function test_wp_ixr_client_can_handle_invalid_urls() {
     61                $client = new WP_HTTP_IXR_Client( '' );
     62                $this->assertSame( '', $client->scheme );
     63                $this->assertSame( '', $client->server );
     64                $this->assertSame( '/', $client->path );
     65        }
    2966}
Note: See TracChangeset for help on using the changeset viewer.