Make WordPress Core

Ticket #39367: 39367.diff

File 39367.diff, 2.7 KB (added by johnbillion, 8 years ago)
  • src/wp-includes/pluggable.php

    diff --git src/wp-includes/pluggable.php src/wp-includes/pluggable.php
    index 3e6fbe14d6..760e50af0b 100644
    function wp_set_auth_cookie( $user_id, $remember = false, $secure = '', $token = 
    900900         */
    901901        do_action( 'set_logged_in_cookie', $logged_in_cookie, $expire, $expiration, $user_id, 'logged_in' );
    902902
     903        /**
     904         * Allows preventing auth cookies from actually being sent to the client.
     905         *
     906         * @since 4.8.0
     907         *
     908         * @param bool $send Whether to send auth cookies to the client.
     909         */
     910        if ( ! apply_filters( 'send_auth_cookies', true ) ) {
     911                return;
     912        }
     913
    903914        setcookie($auth_cookie_name, $auth_cookie, $expire, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN, $secure, true);
    904915        setcookie($auth_cookie_name, $auth_cookie, $expire, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, $secure, true);
    905916        setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, COOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true);
    function wp_clear_auth_cookie() { 
    922933         */
    923934        do_action( 'clear_auth_cookie' );
    924935
     936        /**
     937         * Allows preventing auth cookies from actually being sent to the client.
     938         *
     939         * @since 4.8.0
     940         *
     941         * @param bool $send Whether to send auth cookies to the client.
     942         */
     943        if ( ! apply_filters( 'send_auth_cookies', true ) ) {
     944                return;
     945        }
     946
    925947        setcookie( AUTH_COOKIE,        ' ', time() - YEAR_IN_SECONDS, ADMIN_COOKIE_PATH,   COOKIE_DOMAIN );
    926948        setcookie( SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, ADMIN_COOKIE_PATH,   COOKIE_DOMAIN );
    927949        setcookie( AUTH_COOKIE,        ' ', time() - YEAR_IN_SECONDS, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN );
  • tests/phpunit/includes/functions.php

    diff --git tests/phpunit/includes/functions.php tests/phpunit/includes/functions.php
    index 3a7c9bd98e..d9872fb541 100644
    function _upload_dir_https( $uploads ) { 
    164164
    165165// Skip `setcookie` calls in auth_cookie functions due to warning:
    166166// Cannot modify header information - headers already sent by ...
    167 
    168 function wp_set_auth_cookie( $user_id, $remember = false, $secure = '', $token = '' ) {
    169         $auth_cookie = null;
    170         $expire = null;
    171         $expiration = null;
    172         $user_id = null;
    173         $scheme = null;
    174         /** This action is documented in wp-inclues/pluggable.php */
    175         do_action( 'set_auth_cookie', $auth_cookie, $expire, $expiration, $user_id, $scheme );
    176         $logged_in_cookie = null;
    177         /** This action is documented in wp-inclues/pluggable.php */
    178         do_action( 'set_logged_in_cookie', $logged_in_cookie, $expire, $expiration, $user_id, 'logged_in' );
    179 }
    180 
    181 function wp_clear_auth_cookie() {
    182         /** This action is documented in wp-inclues/pluggable.php */
    183         do_action( 'clear_auth_cookie' );
    184 }
     167tests_add_filter( 'send_auth_cookies', '__return_false' );