Skip to content

Commit

Permalink
Fix token_touch() call in collapse_cache_token()
Browse files Browse the repository at this point in the history
token_touch() requires a token ID, but we give it a TOKEN_COLLAPSE token
type instead, so collapse_cache_token() always tries to update token # 5
rather than the user's token.

Fixes #20824
  • Loading branch information
dregad committed Apr 18, 2016
1 parent e3956c2 commit fd47e9c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions core/collapse_api.php
Expand Up @@ -217,11 +217,15 @@ function collapse_cache_token() {
}
}

if( !$t_update ) {
$t_token = token_get( TOKEN_COLLAPSE );
$t_update = $t_token !== null;
}
if( $t_update ) {
$t_token = json_encode( $g_collapse_cache_token );
token_set( TOKEN_COLLAPSE, $t_token, TOKEN_EXPIRY_COLLAPSE );
$t_value = json_encode( $g_collapse_cache_token );
token_set( TOKEN_COLLAPSE, $t_value, TOKEN_EXPIRY_COLLAPSE );
} else {
token_touch( TOKEN_COLLAPSE );
token_touch( $t_token['id'] );
}

gpc_clear_cookie( 'MANTIS_collapse_settings' );
Expand Down

0 comments on commit fd47e9c

Please sign in to comment.