From 11386c73109e71c6245c43015168b2a25a936171 Mon Sep 17 00:00:00 2001 From: Sainath Poojary Date: Wed, 15 Jul 2026 20:53:45 +0530 Subject: [PATCH 1/2] Comment: Use wp_parse_url() instead of parse_url() --- src/wp-includes/comment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/comment.php b/src/wp-includes/comment.php index 20303dc1e7e17..b2a3db02bce49 100644 --- a/src/wp-includes/comment.php +++ b/src/wp-includes/comment.php @@ -2931,7 +2931,7 @@ function discover_pingback_server_uri( $url, $deprecated = '' ) { $pingback_str_squote = 'rel=\'pingback\''; /** @todo Should use Filter Extension or custom preg_match instead. */ - $parsed_url = parse_url( $url ); + $parsed_url = wp_parse_url( $url ); if ( ! isset( $parsed_url['host'] ) ) { // Not a URL. This should never happen. return false; From 0f1e977b22a011feb7c7fbb3964fe1225a55d78e Mon Sep 17 00:00:00 2001 From: Sainath Poojary Date: Wed, 15 Jul 2026 20:53:54 +0530 Subject: [PATCH 2/2] Tests: Add unit tests for discover_pingback_server_uri() --- .../comment/discoverPingbackServerUri.php | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tests/phpunit/tests/comment/discoverPingbackServerUri.php diff --git a/tests/phpunit/tests/comment/discoverPingbackServerUri.php b/tests/phpunit/tests/comment/discoverPingbackServerUri.php new file mode 100644 index 0000000000000..e172f18c31590 --- /dev/null +++ b/tests/phpunit/tests/comment/discoverPingbackServerUri.php @@ -0,0 +1,38 @@ + array(), + 'body' => '', + 'response' => array( 'code' => 200 ), + 'cookies' => array(), + ); + } + + /** + * @ticket 31384 + */ + public function test_discovers_pingback_uri_for_schemeless_url() { + $result = discover_pingback_server_uri( '//example.com/post' ); + + $this->assertSame( 'https://example.com/pingback', $result ); + } +}