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

Backported from master fd47e9c.
Conflicts:
	core/collapse_api.php
  • Loading branch information
dregad committed May 12, 2016
1 parent f8ea0a0 commit 9109ed6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions core/collapse_api.php
Expand Up @@ -234,11 +234,15 @@ function collapse_cache_token() {
}
}

if( !$t_update ) {
$t_token = token_get( TOKEN_COLLAPSE );
$t_update = $t_token !== null;
}
if( $t_update ) {
$t_token = serialize( $g_collapse_cache_token );
token_set( TOKEN_COLLAPSE, $t_token, TOKEN_EXPIRY_COLLAPSE );
$t_value = serialize( $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 9109ed6

Please sign in to comment.