diff --git a/wp-includes/comment.php b/wp-includes/comment.php index 7d4abd75a9..516c1eb1b5 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -735,7 +735,7 @@ function wp_set_comment_cookies($comment, $user) { * @param int $seconds Comment cookie lifetime. Default 30000000. */ $comment_cookie_lifetime = apply_filters( 'comment_cookie_lifetime', 30000000 ); - $secure = is_https_url( home_url() ); + $secure = ( 'https' === parse_url( home_url(), PHP_URL_SCHEME ) ); setcookie( 'comment_author_' . COOKIEHASH, $comment->comment_author, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN, $secure ); setcookie( 'comment_author_email_' . COOKIEHASH, $comment->comment_author_email, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN, $secure ); setcookie( 'comment_author_url_' . COOKIEHASH, esc_url($comment->comment_author_url), time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN, $secure ); diff --git a/wp-includes/option.php b/wp-includes/option.php index 1d2c35d41f..77c95fdc1f 100644 --- a/wp-includes/option.php +++ b/wp-includes/option.php @@ -746,7 +746,7 @@ function wp_user_settings() { } // The cookie is not set in the current browser or the saved value is newer. - $secure = is_https_url( site_url() ); + $secure = ( 'https' === parse_url( site_url(), PHP_URL_SCHEME ) ); setcookie( 'wp-settings-' . $user_id, $settings, time() + YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN, $secure ); setcookie( 'wp-settings-time-' . $user_id, time(), time() + YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN, $secure ); $_COOKIE['wp-settings-' . $user_id] = $settings; diff --git a/wp-login.php b/wp-login.php index 911d41b044..803708222d 100644 --- a/wp-login.php +++ b/wp-login.php @@ -427,7 +427,7 @@ if ( defined( 'RELOCATE' ) && RELOCATE ) { // Move flag is set } //Set a cookie now to see if they are supported by the browser. -$secure = ( is_https_url( home_url() ) && is_https_url( site_url() ) ); +$secure = ( 'https' === parse_url( site_url(), PHP_URL_SCHEME ) && 'https' === parse_url( home_url(), PHP_URL_SCHEME ) ); setcookie( TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN, $secure ); if ( SITECOOKIEPATH != COOKIEPATH ) setcookie( TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN, $secure ); @@ -469,7 +469,7 @@ case 'postpass' : * @param int $expires The expiry time, as passed to setcookie(). */ $expire = apply_filters( 'post_password_expires', time() + 10 * DAY_IN_SECONDS ); - $secure = is_https_url( home_url() ); + $secure = ( 'https' === parse_url( home_url(), PHP_URL_SCHEME ) ); setcookie( 'wp-postpass_' . COOKIEHASH, $hasher->HashPassword( wp_unslash( $_POST['post_password'] ) ), $expire, COOKIEPATH, COOKIE_DOMAIN, $secure ); wp_safe_redirect( wp_get_referer() );