WordPress.org

Make WordPress Core

Ticket #53236: wp_nonce_tick-align.patch

File wp_nonce_tick-align.patch, 526 bytes (added by lev0, 5 months ago)
  • src/wp-includes/pluggable.php

    a b  
    21452145                 * @param int $lifespan Lifespan of nonces in seconds. Default 86,400 seconds, or one day.
    21462146                 */
    21472147                $nonce_life = apply_filters( 'nonce_life', DAY_IN_SECONDS );
     2148                $time = time();
    21482149
    2149                 return ceil( time() / ( $nonce_life / 2 ) );
     2150                try {
     2151                        $time += ( new DateTime( "@$time" ) )->setTimezone( wp_timezone() )->getOffset() + 1;
     2152                } catch ( Exception $e ) {
     2153                }
     2154
     2155                return ceil( $time / ( $nonce_life / 2 ) );
    21502156        }
    21512157endif;
    21522158