We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fc8ba60 commit aeedfa6Copy full SHA for aeedfa6
inc/authentication/namespace.php
@@ -81,7 +81,10 @@ function get_token_from_request() {
81
* @return \WP_User|int|\WP_Error
82
*/
83
function attempt_authentication( $user = null ) {
84
- if ( ! empty( $user ) ) {
+ // Lock against infinite loops when querying the token itself.
85
+ static $is_querying_token = false;
86
+
87
+ if ( ! empty( $user ) || $is_querying_token ) {
88
return $user;
89
}
90
@@ -93,7 +96,10 @@ function attempt_authentication( $user = null ) {
93
96
94
97
95
98
// Attempt to find the token.
99
+ $is_querying_token = true;
100
$token = Tokens\get_by_id( $token_value );
101
+ $is_querying_token = false;
102
103
if ( empty( $token ) ) {
104
return create_invalid_token_error( $token );
105
0 commit comments