PHP warning on switch_to_olduser
-
This happens on action ‘switch_to_olduser’
ErrorException: Warning: Trying to access array offset on value of type bool
#8 /wp-content/plugins/user-switching/user-switching.php(128): user_switching::remember
[…]The relevant code starting at line 124.
$current = wp_parse_auth_cookie( '', 'logged_in' ); // Here we calculate the expiration length of the current auth cookie and compare it to the default expiration. // If it's greater than this, then we know the user checked 'Remember Me' when they logged in. return ( ( $current['expiration'] - time() ) > $cookie_life );
The function
wp_parse_auth_cookie
can return a (bool)false
. Then you can’t do an array lookup. Replacingreturn
withreturn $current &&
should do the trick.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘PHP warning on switch_to_olduser’ is closed to new replies.