{"action":"created","issue":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/6742","labels_url":"https://api.github.com/repos/yiisoft/yii2/issues/6742/labels{/name}","comments_url":"https://api.github.com/repos/yiisoft/yii2/issues/6742/comments","events_url":"https://api.github.com/repos/yiisoft/yii2/issues/6742/events","html_url":"https://github.com/yiisoft/yii2/issues/6742","id":53322722,"number":6742,"title":"Log in by cookie error ","user":{"login":"kakalos12","id":4671261,"avatar_url":"https://avatars.githubusercontent.com/u/4671261?v=3","gravatar_id":"","url":"https://api.github.com/users/kakalos12","html_url":"https://github.com/kakalos12","followers_url":"https://api.github.com/users/kakalos12/followers","following_url":"https://api.github.com/users/kakalos12/following{/other_user}","gists_url":"https://api.github.com/users/kakalos12/gists{/gist_id}","starred_url":"https://api.github.com/users/kakalos12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kakalos12/subscriptions","organizations_url":"https://api.github.com/users/kakalos12/orgs","repos_url":"https://api.github.com/users/kakalos12/repos","events_url":"https://api.github.com/users/kakalos12/events{/privacy}","received_events_url":"https://api.github.com/users/kakalos12/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/yiisoft/yii2/labels/feature:mongodb","name":"feature:mongodb","color":"c7def8"},{"url":"https://api.github.com/repos/yiisoft/yii2/labels/status:to%20be%20verified","name":"status:to be verified","color":"fbca04"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-01-04T02:38:57Z","updated_at":"2016-01-02T23:05:35Z","closed_at":"2015-04-10T10:48:52Z","body":"Hi all, \r\nI posted the error here. Do you have any solution for this ? \r\nhttp://www.yiiframework.com/forum/index.php/topic/60797-login-by-cookie-error-when-using-mongodb/page__gopid__270753#entry270753\r\n\r\nThanks,\r\nDong "},"comment":{"url":"https://api.github.com/repos/yiisoft/yii2/issues/comments/168437503","html_url":"https://github.com/yiisoft/yii2/issues/6742#issuecomment-168437503","issue_url":"https://api.github.com/repos/yiisoft/yii2/issues/6742","id":168437503,"user":{"login":"zorobabel","id":12666007,"avatar_url":"https://avatars.githubusercontent.com/u/12666007?v=3","gravatar_id":"","url":"https://api.github.com/users/zorobabel","html_url":"https://github.com/zorobabel","followers_url":"https://api.github.com/users/zorobabel/followers","following_url":"https://api.github.com/users/zorobabel/following{/other_user}","gists_url":"https://api.github.com/users/zorobabel/gists{/gist_id}","starred_url":"https://api.github.com/users/zorobabel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zorobabel/subscriptions","organizations_url":"https://api.github.com/users/zorobabel/orgs","repos_url":"https://api.github.com/users/zorobabel/repos","events_url":"https://api.github.com/users/zorobabel/events{/privacy}","received_events_url":"https://api.github.com/users/zorobabel/received_events","type":"User","site_admin":false},"created_at":"2016-01-02T23:05:35Z","updated_at":"2016-01-02T23:05:35Z","body":"Hi guys.\r\n\r\n@kakalos12, @coldice4 is right, the **id** value coming from the cookie is an array, not a single value! Something like this:\r\n\r\n```php\r\narray(3) {\r\n  [0]=>\r\n  array(1) {\r\n    [\"$id\"]=>\r\n    string(24) \"568823f5900293c818000029\"\r\n  }\r\n  [1]=>\r\n  string(32) \"6aeL770pSq5J8m-Q5oTJQoGZVHya1iUe\"\r\n  [2]=>\r\n  int(2592000)\r\n}\r\n```\r\nFrom **[here](https://github.com/yiisoft/yii2/blob/master/framework/web/User.php#L280)** to **[here](https://github.com/yiisoft/yii2/blob/master/framework/web/User.php#L292)** you can see the root of the problem.\r\n\r\nI am having a headhache with and had to add the following piece of code after [line 292](https://github.com/yiisoft/yii2/blob/master/framework/web/User.php#L292):\r\n\r\n```php\r\nif (is_array($id)) {\r\n    $id = $id[0];\r\n}\r\n```\r\n\"It works\" but It seems I am not logged in:\r\n\r\n![nir](https://cloud.githubusercontent.com/assets/12666007/12076506/370b5a7c-b17b-11e5-8a8e-81f793c937c4.png)\r\n\r\n@samdark, @klimov-paul any idea? Can you fix it? Thanks."}}