Skip to content

Commit 75c587f

Browse files
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. git-svn-id: https://develop.svn.wordpress.org/trunk@59459 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 1aa41de commit 75c587f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/wp-includes/pluggable.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -710,9 +710,10 @@ function wp_validate_auth_cookie( $cookie = '', $scheme = '' ) {
710710
$username = $cookie_elements['username'];
711711
$hmac = $cookie_elements['hmac'];
712712
$token = $cookie_elements['token'];
713-
$expired = $cookie_elements['expiration'];
714713
$expiration = $cookie_elements['expiration'];
715714

715+
$expired = (int) $expiration;
716+
716717
// Allow a grace period for POST and Ajax requests.
717718
if ( wp_doing_ajax() || 'POST' === $_SERVER['REQUEST_METHOD'] ) {
718719
$expired += HOUR_IN_SECONDS;

0 commit comments

Comments
 (0)