Build/Test tools: Don't override the `wp_set_auth_cookie()` and `wp_clear_auth_cookie()` functions.
Overriding pluggable functions in the test suite is asking for trouble in the future. In addition, it means the test suite can't be guaranteed to behave the same as core. This instead introduces a `send_auth_cookies` filter which can be hooked in during the test suite to prevent these functions from attempting to send cookie headers to the client. Fixes #39367 Merges [40263] and [40264] to the 4.7 branch. Built from https://develop.svn.wordpress.org/branches/4.7@40265 git-svn-id: http://core.svn.wordpress.org/branches/4.7@40185 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f0be016b5e
commit
7bebbc7006
|
@ -890,6 +890,17 @@ function wp_set_auth_cookie( $user_id, $remember = false, $secure = '', $token =
|
|||
*/
|
||||
do_action( 'set_logged_in_cookie', $logged_in_cookie, $expire, $expiration, $user_id, 'logged_in' );
|
||||
|
||||
/**
|
||||
* Allows preventing auth cookies from actually being sent to the client.
|
||||
*
|
||||
* @since 4.7.4
|
||||
*
|
||||
* @param bool $send Whether to send auth cookies to the client.
|
||||
*/
|
||||
if ( ! apply_filters( 'send_auth_cookies', true ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
setcookie($auth_cookie_name, $auth_cookie, $expire, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN, $secure, true);
|
||||
setcookie($auth_cookie_name, $auth_cookie, $expire, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, $secure, true);
|
||||
setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, COOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true);
|
||||
|
@ -912,6 +923,11 @@ function wp_clear_auth_cookie() {
|
|||
*/
|
||||
do_action( 'clear_auth_cookie' );
|
||||
|
||||
/** This filter is documented in wp-includes/pluggable.php */
|
||||
if ( ! apply_filters( 'send_auth_cookies', true ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
setcookie( AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, ADMIN_COOKIE_PATH, COOKIE_DOMAIN );
|
||||
setcookie( SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, ADMIN_COOKIE_PATH, COOKIE_DOMAIN );
|
||||
setcookie( AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN );
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.7.4-alpha-40260';
|
||||
$wp_version = '4.7.4-alpha-40265';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue