Make WordPress Core


Ignore:
Timestamp:
07/15/2019 06:24:08 AM (6 years ago)
Author:
pento
Message:

Code Modernisation: Fix known instances of array access on data types that can't be accessed as arrays.

PHP 7.4 addes a warning when trying access a null/bool/int/float/resource (everything but array, string and object) as if it were an array.

This change fixes all of these warnings visible in unit tests.

Props jrf.
See #47704.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/user.php

    r45590 r45639  
    20892089            /** This filter is documented in wp-includes/pluggable.php */
    20902090            $default_cookie_life = apply_filters( 'auth_cookie_expiration', ( 2 * DAY_IN_SECONDS ), $ID, false );
    2091             $remember            = ( ( $logged_in_cookie['expiration'] - time() ) > $default_cookie_life );
     2091            $remember            = false;
     2092            if ( false !== $logged_in_cookie && ( $logged_in_cookie['expiration'] - time() ) > $default_cookie_life ) {
     2093                $remember = true;
     2094            }
    20922095
    20932096            wp_set_auth_cookie( $ID, $remember );
Note: See TracChangeset for help on using the changeset viewer.