HMS-Core/hms-push-serverdemo-php

Token refresh fails

syslogic opened this issue · 1 comments

In method refresh_token() it is being assumed that an array is being returned, which is not the case:

array_key_exists("access_token", $result)

Therefore it should rather be:

property_exists($result, "access_token")

Previously type-checking the $result could prevent passing the wrong data-type:

if (
    $result == null ||
    is_array($result) && !array_key_exists("access_token", $result) ||
    is_object($result) && !property_exists($result, "access_token")
)  {
    return null;
}

We have verified that array_KEY_EXISTS ("access_token", $result) is common to the property_exists($result, "access_token") function in this scenario, so there's no need to modify that.