[wp-trac] [WordPress Trac] #40060: Define ADMIN_COOKIE_PATH cause unreachable /wp-login.php

WordPress Trac noreply at wordpress.org
Tue Mar 7 13:11:57 UTC 2017


#40060: Define ADMIN_COOKIE_PATH cause unreachable /wp-login.php
--------------------------+-----------------------------
 Reporter:  esemlabel     |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Users         |    Version:  4.7.3
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 If user is logged in and tries to open /wp-login.php page, he never
 couldn't do this if ADMIN_COOKIE_PATH is set to root '/' (is equal to
 COOKIEPATH). Instead, the redirect to /wp-admin/ will occur. Even more,
 many of function during page load will run twice.

 In a long route of functions, the last one is wp_parse_auth_cookie(),
 which return false to many functions called from, which cause "true" check
 in wp-login.php on line 814, where unneeded redirect happens.

 {{{#!php
 <?php
 if ( !is_wp_error($user) && !$reauth ) {
 ...
 wp_redirect( $redirect_to );
 exit();
 }}}


 In regular situation, wp_parse_auth_cookie() return "false" when checking
 auth cookie on wp-login.php from path '/', because existing one is for
 /wp-admin path. So wp-login.php loads normally.

 {{{#!php
 <?php
 if ( empty($_COOKIE[$cookie_name]) )
         return false;
 }}}

 But if ADMIN_COOKIE_PATH is defined with value, that not differs from
 COOKIEPATH or SITECOOKIEPATH - it return "true" and forever redirect to
 /wp-admin/.

 Any ideas to solve this?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40060>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list