'不允许'SimpleXMLElement'的序列化'

时间:2015-05-15 17:02:08

标签: hybridauth

我已经改变了HybridAuth的路径结构,所有的HybridAuth文件都在登录目录中。

require_once('login/Auth.php');
$auth = new Hybrid_Auth(self::$settings['auth']);

其中self::$settings['auth']是这个json文件

{
  "debug": 1,
  "database": {
    "driver": "mysql",
    "host": "localhost",
    "port": 3306,
    "name": "ws_db",
    "username": "root",
    "password": "",
    "charset": "utf8"
  },
  "auth": {
    "base_url": "http://localhost/login/process",
    "providers": {
      "Twitter": {
        "enabled": true
      },
      "Google": {
        "enabled": true,
        "keys": {
          "id": "",
          "secret": ""
        }
      },
      "Facebook": {
        "enabled": true,
        "keys": {
          "id": "",
          "secret": ""
        },
        "trustForwarded": false
      },
      "Steam": {
        "enabled": true
      }
    },
    "debug_mode": true,
    "debug_file": "auth.txt"
  }
}

我还没有获得我打算使用的提供商的密钥(这可能是为什么会发生这种情况?)。我尝试使用Steam登录来测试它是否正常工作,因为它是唯一一个不需要我获取密钥的提供商。

$_SESSION['user'] = $auth->authenticate('Steam');

我被正确地重定向到Steam登录页面,但是点击登录后我收到了上述错误。 Fatal error: Uncaught exception 'Exception' with message 'Serialization of 'SimpleXMLElement' is not allowed' in login\Auth.php:153 Stack trace: #0 login\Auth.php(39): Hybrid_Auth::initialize(Array) #1 index.php(83): Hybrid_Auth->__construct(Array) #2 index.php(6): Site::main() #3 {main} thrown in login\Auth.php on line 153

我认为这可能与这一行有关:

Hybrid_Logger::debug( "Hybrid_Auth initialize. dump used config: ", serialize( $config ) );

因为这是我看到序列化某些内容的唯一一行,但评论出来似乎并不起作用。我的index.php中的第83行是Hybrid_Auth的初始化。

$auth = new Hybrid_Auth(self::$settings['auth']);

我似乎无法弄清楚这有什么问题。由于该行代码在尝试登录时运行,并且仅在从Steam授权页面返回时导致问题。

以下是输出到auth.txt的信息,我删除了一些信息。

(
    [message:protected] => Serialization of 'SimpleXMLElement' is not allowed
    [string:Exception:private] => 
    [code:protected] => 0
    [file:protected] => login\Storage.php
    [line:protected] => 73
    [trace:Exception:private] => Array
        (
            [0] => Array
                (
                    [file] => login\Storage.php
                    [line] => 73
                    [function] => serialize
                    [args] => Array
                        (
                            [0] => Hybrid_User Object
                                (
                                    [providerId] => Steam
                                    [timestamp] => 1431707732
                                    [profile] => Hybrid_User_Profile Object
                                        (
                                            [identifier] => ***************
                                            [webSiteURL] => 
                                            [profileURL] => http://steamcommunity.com/id/******/
                                            [photoURL] => 
                                            [displayName] => Renari
                                            [description] => <span>profile information was here</span>
                                            [firstName] => SimpleXMLElement Object
                                                (
                                                    [0] => SimpleXMLElement Object
                                                        (
                                                        )

                                                )

                                            [lastName] => 
                                            [gender] => 
                                            [language] => 
                                            [age] => 
                                            [birthDay] => 
                                            [birthMonth] => 
                                            [birthYear] => 
                                            [email] => 
                                            [emailVerified] => 
                                            [phone] => 
                                            [address] => 
                                            [country] => 
                                            [region] => location information was here
                                            [city] => 
                                            [zip] => 
                                        )

                                )

                        )

                )

            [1] => Array
                (
                    [file] => login\Providers\Steam.php
                    [line] => 37
                    [function] => set
                    [class] => Hybrid_Storage
                    [type] => ->
                    [args] => Array
                        (
                            [0] => hauth_session.Steam.user
                            [1] => Hybrid_User Object
                                (
                                    [providerId] => Steam
                                    [timestamp] => 1431707732
                                    [profile] => Hybrid_User_Profile Object
                                        (
                                            [identifier] => ***************
                                            [webSiteURL] => 
                                            [profileURL] => http://steamcommunity.com/id/******/
                                            [photoURL] => 
                                            [displayName] => ******
                                            [description] => <span>profile information was here</span>
                                            [firstName] => SimpleXMLElement Object
                                                (
                                                    [0] => SimpleXMLElement Object
                                                        (
                                                        )

                                                )

                                            [lastName] => 
                                            [gender] => 
                                            [language] => 
                                            [age] => 
                                            [birthDay] => 
                                            [birthMonth] => 
                                            [birthYear] => 
                                            [email] => 
                                            [emailVerified] => 
                                            [phone] => 
                                            [address] => 
                                            [country] => 
                                            [region] => location information was here
                                            [city] => 
                                            [zip] => 
                                        )

                                )

                        )

                )

            [2] => Array
                (
                    [file] => login\Endpoint.php
                    [line] => 182
                    [function] => loginFinish
                    [class] => Hybrid_Providers_Steam
                    [type] => ->
                    [args] => Array
                        (
                        )

                )

            [3] => Array
                (
                    [file] => login\Endpoint.php
                    [line] => 55
                    [function] => processAuthDone
                    [class] => Hybrid_Endpoint
                    [type] => ->
                    [args] => Array
                        (
                        )

                )

            [4] => Array
                (
                    [file] => login\Endpoint.php
                    [line] => 71
                    [function] => __construct
                    [class] => Hybrid_Endpoint
                    [type] => ->
                    [args] => Array
                        (
                            [0] => 
                        )

                )

            [5] => Array
                (
                    [file] => index.php
                    [line] => 90
                    [function] => process
                    [class] => Hybrid_Endpoint
                    [type] => ::
                    [args] => Array
                        (
                        )

                )

            [6] => Array
                (
                    [file] => index.php
                    [line] => 6
                    [function] => main
                    [class] => Site
                    [type] => ::
                    [args] => Array
                        (
                        )

                )

        )

    [previous:Exception:private] => 
)

1 个答案:

答案 0 :(得分:0)

这是Steam提供商的问题,并在commit中修复,您可以从github repo下载固定的Steam提供程序。