WordPress.org

Make WordPress Core

Ticket #28427: 28427.patch

File 28427.patch, 2.7 KB (added by ocean90, 6 years ago)
  • src/wp-includes/comment.php

     
    735735         * @param int $seconds Comment cookie lifetime. Default 30000000.
    736736         */
    737737        $comment_cookie_lifetime = apply_filters( 'comment_cookie_lifetime', 30000000 );
    738         $secure = is_https_url( home_url() );
     738        $secure = ( 'https' === parse_url( home_url(), PHP_URL_SCHEME ) );
    739739        setcookie( 'comment_author_' . COOKIEHASH, $comment->comment_author, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN, $secure );
    740740        setcookie( 'comment_author_email_' . COOKIEHASH, $comment->comment_author_email, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN, $secure );
    741741        setcookie( 'comment_author_url_' . COOKIEHASH, esc_url($comment->comment_author_url), time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN, $secure );
  • src/wp-includes/option.php

     
    746746        }
    747747
    748748        // The cookie is not set in the current browser or the saved value is newer.
    749         $secure = is_https_url( site_url() );
     749        $secure = ( 'https' === parse_url( site_url(), PHP_URL_SCHEME ) );
    750750        setcookie( 'wp-settings-' . $user_id, $settings, time() + YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN, $secure );
    751751        setcookie( 'wp-settings-time-' . $user_id, time(), time() + YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN, $secure );
    752752        $_COOKIE['wp-settings-' . $user_id] = $settings;
  • src/wp-login.php

     
    427427}
    428428
    429429//Set a cookie now to see if they are supported by the browser.
    430 $secure = ( is_https_url( home_url() ) && is_https_url( site_url() ) );
     430$secure = ( 'https' === parse_url( site_url(), PHP_URL_SCHEME ) && 'https' === parse_url( home_url(), PHP_URL_SCHEME ) );
    431431setcookie( TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN, $secure );
    432432if ( SITECOOKIEPATH != COOKIEPATH )
    433433        setcookie( TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN, $secure );
     
    469469         * @param int $expires The expiry time, as passed to setcookie().
    470470         */
    471471        $expire = apply_filters( 'post_password_expires', time() + 10 * DAY_IN_SECONDS );
    472         $secure = is_https_url( home_url() );
     472        $secure = ( 'https' === parse_url( home_url(), PHP_URL_SCHEME ) );
    473473        setcookie( 'wp-postpass_' . COOKIEHASH, $hasher->HashPassword( wp_unslash( $_POST['post_password'] ) ), $expire, COOKIEPATH, COOKIE_DOMAIN, $secure );
    474474
    475475        wp_safe_redirect( wp_get_referer() );