Coding Standards: Cast $expired to an integer in wp_validate_auth_cookie().

This resolves an issue where the string `$expired` value is used both in a comparison and addition with integer values.

Follow-up to [6387], [28424], [45590].

Props justlevine.
See #52217.
Built from https://develop.svn.wordpress.org/trunk@59459


git-svn-id: http://core.svn.wordpress.org/trunk@58845 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2024-11-25 19:03:18 +00:00
parent f03be09041
commit 6f6ddfc80f
2 changed files with 3 additions and 2 deletions

View File

@ -710,9 +710,10 @@ if ( ! function_exists( 'wp_validate_auth_cookie' ) ) :
$username = $cookie_elements['username']; $username = $cookie_elements['username'];
$hmac = $cookie_elements['hmac']; $hmac = $cookie_elements['hmac'];
$token = $cookie_elements['token']; $token = $cookie_elements['token'];
$expired = $cookie_elements['expiration'];
$expiration = $cookie_elements['expiration']; $expiration = $cookie_elements['expiration'];
$expired = (int) $expiration;
// Allow a grace period for POST and Ajax requests. // Allow a grace period for POST and Ajax requests.
if ( wp_doing_ajax() || 'POST' === $_SERVER['REQUEST_METHOD'] ) { if ( wp_doing_ajax() || 'POST' === $_SERVER['REQUEST_METHOD'] ) {
$expired += HOUR_IN_SECONDS; $expired += HOUR_IN_SECONDS;

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.8-alpha-59458'; $wp_version = '6.8-alpha-59459';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.