Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenID getUserProfile() returns a phpIncompleteClass object #1007

Closed
Shade- opened this issue Oct 7, 2018 · 2 comments · Fixed by #1238
Closed

OpenID getUserProfile() returns a phpIncompleteClass object #1007

Shade- opened this issue Oct 7, 2018 · 2 comments · Fixed by #1238

Comments

@Shade-
Copy link
Contributor

Shade- commented Oct 7, 2018

Bug

When trying to run getUserProfile() with a OpenID-powered provider, such as Steam, the OpenID service will fire an exception with the following message: Provider returned an unexpected response. Dug deep into the cause of this, it seems like Hybridauth/Adapter/OpenID.php, line 267 returns a phpIncompleteClass object, which then fails the next is_object check:

$userProfile = $this->storage->get($this->providerId . '.user');

if (! is_object($userProfile)) {

I don't know why and how to solve this.

Version and provider

Steam, version 3.0 RC 7

PHP 7.1.2

Reproduction

Set up a regular Steam provider authentication flow. Authenticate. Try to run getUserProfile() when already authenticated, Hybridauth returns Provider returned an unexpected response..

@Shade-
Copy link
Contributor Author

Shade- commented Oct 22, 2018

Ah, my bad. If your project initialized PHP's session before including Hybridauth, the Hybridauth\User\Profile class is not yet initialized, causing the object to be marked as phpIncompleteClass. This is not a bug intrinsic to Hybridauth, however, given most of PHP applications make use of PHP session, maybe the logic can be changed somehow.

@chrisgraham
Copy link
Contributor

This seems like a pretty easy fix. I am not messing with OpenID so I can't test it, but it seems if you just serialize any object before putting it into storage, and unserialize it when you get it out, this will defer the class check.
Probably should not be storing objects in the StorageInterface anyway, it is defined as a string key value store..,

    /**
    * Add or Update an item to storage
    *
    * @param string $key
    * @param string $value
    */
    public function set($key, $value);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants