mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-03-31 18:54:29 +00:00
Security: Fix bug in wp_is_local_html_output().
Prior to this changeset, the check for the correct RSD link output was relying on a specific protocol, although it needs to accept both the HTTP and HTTPS version of the URL. Props TimothyBlynJacobs. Fixes #52542. See #47577. git-svn-id: https://develop.svn.wordpress.org/trunk@50391 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -171,6 +171,7 @@ class Tests_HTTPS_Detection extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 47577
|
||||
* @ticket 52542
|
||||
*/
|
||||
public function test_wp_is_local_html_output_via_rsd_link() {
|
||||
// HTML includes RSD link.
|
||||
@@ -183,6 +184,12 @@ class Tests_HTTPS_Detection extends WP_UnitTestCase {
|
||||
$html = $this->get_sample_html_string( $head_tag );
|
||||
$this->assertTrue( wp_is_local_html_output( $html ) );
|
||||
|
||||
// HTML includes RSD link with alternative URL scheme.
|
||||
$head_tag = get_echo( 'rsd_link' );
|
||||
$head_tag = false !== strpos( $head_tag, 'https://' ) ? str_replace( 'https://', 'http://', $head_tag ) : str_replace( 'http://', 'https://', $head_tag );
|
||||
$html = $this->get_sample_html_string( $head_tag );
|
||||
$this->assertTrue( wp_is_local_html_output( $html ) );
|
||||
|
||||
// HTML does not include RSD link.
|
||||
$html = $this->get_sample_html_string();
|
||||
$this->assertFalse( wp_is_local_html_output( $html ) );
|
||||
|
||||
Reference in New Issue
Block a user