mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-03-31 18:54:29 +00:00
Security: Allow short-circuiting the wp_update_https_detection_errors() process.
This changeset introduces a `pre_wp_update_https_detection_errors` filter which can be used to short-circuit the default logic for detecting problems with HTTPS support for the site, by returning a `WP_Error` object. Props timothyblynjacobs. See #47577. git-svn-id: https://develop.svn.wordpress.org/trunk@50075 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -109,6 +109,37 @@ class Tests_HTTPS_Detection extends WP_UnitTestCase {
|
||||
$this->assertEquals( 'https://example.com/', $this->last_request_url );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 47577
|
||||
*/
|
||||
public function test_pre_wp_update_https_detection_errors() {
|
||||
// Override to enforce no errors being detected.
|
||||
add_filter(
|
||||
'pre_wp_update_https_detection_errors',
|
||||
function() {
|
||||
return new WP_Error();
|
||||
}
|
||||
);
|
||||
wp_update_https_detection_errors();
|
||||
$this->assertEquals( array(), get_option( 'https_detection_errors' ) );
|
||||
|
||||
// Override to enforce an error being detected.
|
||||
add_filter(
|
||||
'pre_wp_update_https_detection_errors',
|
||||
function() {
|
||||
return new WP_Error(
|
||||
'ssl_verification_failed',
|
||||
'Bad SSL certificate.'
|
||||
);
|
||||
}
|
||||
);
|
||||
wp_update_https_detection_errors();
|
||||
$this->assertEquals(
|
||||
array( 'ssl_verification_failed' => array( 'Bad SSL certificate.' ) ),
|
||||
get_option( 'https_detection_errors' )
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 47577
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user