{"action":"created","comment":{"url":"https://api.github.com/repos/yiisoft/yii2/pulls/comments/22443510","id":22443510,"diff_hunk":"@@ -229,13 +226,29 @@ public function setHasSessionId($value)\n     }\n \n     /**\n-     * Gets the session ID.\n-     * This is a wrapper for [PHP session_id()](http://php.net/manual/en/function.session-id.php).\n+     * Gets a session ID from the request or null if there is no session ID in the request\n+     * @return string|null\n+     */\n+    private function getRequestSessionIdInternal()\n+    {\n+        $name = $this->getName();\n+        $request = Yii::$app->getRequest();\n+        if (ini_get('session.use_cookies') && !empty($_COOKIE[$name])) {\n+            return $_COOKIE[$name];\n+        }\n+        if (!ini_get('session.use_only_cookies') && ini_get('session.use_trans_sid')) {\n+            return $request->get($name);\n+        }\n+        return null;\n+    }\n+\n+    /**\n+     * Gets the session ID even the session hasn't yet started\n      * @return string the current session ID\n      */\n     public function getId()\n     {\n-        return session_id();\n+        return session_id() ?: ($this->getRequestSessionIdInternal() ?: '');","path":"framework/web/Session.php","position":63,"original_position":63,"commit_id":"1a33ecbcfb0cd8029602b39cb8c5f898295d9da1","original_commit_id":"1a33ecbcfb0cd8029602b39cb8c5f898295d9da1","user":{"login":"TriAnMan","id":2266882,"avatar_url":"https://avatars.githubusercontent.com/u/2266882?v=3","gravatar_id":"","url":"https://api.github.com/users/TriAnMan","html_url":"https://github.com/TriAnMan","followers_url":"https://api.github.com/users/TriAnMan/followers","following_url":"https://api.github.com/users/TriAnMan/following{/other_user}","gists_url":"https://api.github.com/users/TriAnMan/gists{/gist_id}","starred_url":"https://api.github.com/users/TriAnMan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TriAnMan/subscriptions","organizations_url":"https://api.github.com/users/TriAnMan/orgs","repos_url":"https://api.github.com/users/TriAnMan/repos","events_url":"https://api.github.com/users/TriAnMan/events{/privacy}","received_events_url":"https://api.github.com/users/TriAnMan/received_events","type":"User","site_admin":false},"body":"PHP `session_regenerate_id()` will do anything only if the session is started.\r\nIf user sets any ID with `session_id('SOME_SESSION_ID')` then `getId()` method will return this ID.\r\nAnd there is no any other functions in PHP that deals with session ID.","created_at":"2015-01-04T22:35:31Z","updated_at":"2015-01-04T22:35:31Z","html_url":"https://github.com/yiisoft/yii2/pull/6634#discussion_r22443510","pull_request_url":"https://api.github.com/repos/yiisoft/yii2/pulls/6634","_links":{"self":{"href":"https://api.github.com/repos/yiisoft/yii2/pulls/comments/22443510"},"html":{"href":"https://github.com/yiisoft/yii2/pull/6634#discussion_r22443510"},"pull_request":{"href":"https://api.github.com/repos/yiisoft/yii2/pulls/6634"}}},"pull_request":{"url":"https://api.github.com/repos/yiisoft/yii2/pulls/6634","id":26520910,"html_url":"https://github.com/yiisoft/yii2/pull/6634","diff_url":"https://github.com/yiisoft/yii2/pull/6634.diff","patch_url":"https://github.com/yiisoft/yii2/pull/6634.patch","issue_url":"https://api.github.com/repos/yiisoft/yii2/issues/6634","number":6634,"state":"open","locked":false,"title":"Destroy the session after a test","user":{"login":"TriAnMan","id":2266882,"avatar_url":"https://avatars.githubusercontent.com/u/2266882?v=3","gravatar_id":"","url":"https://api.github.com/users/TriAnMan","html_url":"https://github.com/TriAnMan","followers_url":"https://api.github.com/users/TriAnMan/followers","following_url":"https://api.github.com/users/TriAnMan/following{/other_user}","gists_url":"https://api.github.com/users/TriAnMan/gists{/gist_id}","starred_url":"https://api.github.com/users/TriAnMan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TriAnMan/subscriptions","organizations_url":"https://api.github.com/users/TriAnMan/orgs","repos_url":"https://api.github.com/users/TriAnMan/repos","events_url":"https://api.github.com/users/TriAnMan/events{/privacy}","received_events_url":"https://api.github.com/users/TriAnMan/received_events","type":"User","site_admin":false},"body":"This can help with one hard-to-find bug in tests.\r\n\r\nSteps to reproduce will be provided.","created_at":"2014-12-23T17:03:57Z","updated_at":"2015-01-04T22:35:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"92bfbe925f1e9d4748e425ff48dfd97c71d621be","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/yiisoft/yii2/pulls/6634/commits","review_comments_url":"https://api.github.com/repos/yiisoft/yii2/pulls/6634/comments","review_comment_url":"https://api.github.com/repos/yiisoft/yii2/pulls/comments/{number}","comments_url":"https://api.github.com/repos/yiisoft/yii2/issues/6634/comments","statuses_url":"https://api.github.com/repos/yiisoft/yii2/statuses/1a33ecbcfb0cd8029602b39cb8c5f898295d9da1","head":{"label":"TriAnMan:end-session-after-test","ref":"end-session-after-test","sha":"1a33ecbcfb0cd8029602b39cb8c5f898295d9da1","user":{"login":"TriAnMan","id":2266882,"avatar_url":"https://avatars.githubusercontent.com/u/2266882?v=3","gravatar_id":"","url":"https://api.github.com/users/TriAnMan","html_url":"https://github.com/TriAnMan","followers_url":"https://api.github.com/users/TriAnMan/followers","following_url":"https://api.github.com/users/TriAnMan/following{/other_user}","gists_url":"https://api.github.com/users/TriAnMan/gists{/gist_id}","starred_url":"https://api.github.com/users/TriAnMan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TriAnMan/subscriptions","organizations_url":"https://api.github.com/users/TriAnMan/orgs","repos_url":"https://api.github.com/users/TriAnMan/repos","events_url":"https://api.github.com/users/TriAnMan/events{/privacy}","received_events_url":"https://api.github.com/users/TriAnMan/received_events","type":"User","site_admin":false},"repo":{"id":20063609,"name":"yii2","full_name":"TriAnMan/yii2","owner":{"login":"TriAnMan","id":2266882,"avatar_url":"https://avatars.githubusercontent.com/u/2266882?v=3","gravatar_id":"","url":"https://api.github.com/users/TriAnMan","html_url":"https://github.com/TriAnMan","followers_url":"https://api.github.com/users/TriAnMan/followers","following_url":"https://api.github.com/users/TriAnMan/following{/other_user}","gists_url":"https://api.github.com/users/TriAnMan/gists{/gist_id}","starred_url":"https://api.github.com/users/TriAnMan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TriAnMan/subscriptions","organizations_url":"https://api.github.com/users/TriAnMan/orgs","repos_url":"https://api.github.com/users/TriAnMan/repos","events_url":"https://api.github.com/users/TriAnMan/events{/privacy}","received_events_url":"https://api.github.com/users/TriAnMan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/TriAnMan/yii2","description":"Yii 2 framework main development repo","fork":true,"url":"https://api.github.com/repos/TriAnMan/yii2","forks_url":"https://api.github.com/repos/TriAnMan/yii2/forks","keys_url":"https://api.github.com/repos/TriAnMan/yii2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TriAnMan/yii2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TriAnMan/yii2/teams","hooks_url":"https://api.github.com/repos/TriAnMan/yii2/hooks","issue_events_url":"https://api.github.com/repos/TriAnMan/yii2/issues/events{/number}","events_url":"https://api.github.com/repos/TriAnMan/yii2/events","assignees_url":"https://api.github.com/repos/TriAnMan/yii2/assignees{/user}","branches_url":"https://api.github.com/repos/TriAnMan/yii2/branches{/branch}","tags_url":"https://api.github.com/repos/TriAnMan/yii2/tags","blobs_url":"https://api.github.com/repos/TriAnMan/yii2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TriAnMan/yii2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TriAnMan/yii2/git/refs{/sha}","trees_url":"https://api.github.com/repos/TriAnMan/yii2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TriAnMan/yii2/statuses/{sha}","languages_url":"https://api.github.com/repos/TriAnMan/yii2/languages","stargazers_url":"https://api.github.com/repos/TriAnMan/yii2/stargazers","contributors_url":"https://api.github.com/repos/TriAnMan/yii2/contributors","subscribers_url":"https://api.github.com/repos/TriAnMan/yii2/subscribers","subscription_url":"https://api.github.com/repos/TriAnMan/yii2/subscription","commits_url":"https://api.github.com/repos/TriAnMan/yii2/commits{/sha}","git_commits_url":"https://api.github.com/repos/TriAnMan/yii2/git/commits{/sha}","comments_url":"https://api.github.com/repos/TriAnMan/yii2/comments{/number}","issue_comment_url":"https://api.github.com/repos/TriAnMan/yii2/issues/comments/{number}","contents_url":"https://api.github.com/repos/TriAnMan/yii2/contents/{+path}","compare_url":"https://api.github.com/repos/TriAnMan/yii2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TriAnMan/yii2/merges","archive_url":"https://api.github.com/repos/TriAnMan/yii2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TriAnMan/yii2/downloads","issues_url":"https://api.github.com/repos/TriAnMan/yii2/issues{/number}","pulls_url":"https://api.github.com/repos/TriAnMan/yii2/pulls{/number}","milestones_url":"https://api.github.com/repos/TriAnMan/yii2/milestones{/number}","notifications_url":"https://api.github.com/repos/TriAnMan/yii2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TriAnMan/yii2/labels{/name}","releases_url":"https://api.github.com/repos/TriAnMan/yii2/releases{/id}","created_at":"2014-05-22T14:15:01Z","updated_at":"2014-12-02T11:36:16Z","pushed_at":"2014-12-29T11:39:54Z","git_url":"git://github.com/TriAnMan/yii2.git","ssh_url":"git@github.com:TriAnMan/yii2.git","clone_url":"https://github.com/TriAnMan/yii2.git","svn_url":"https://github.com/TriAnMan/yii2","homepage":"http://www.yiiframework.com","size":33110,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"yiisoft:master","ref":"master","sha":"3254a4ba8a7f2c434f09d63f23ddb53fa071a742","user":{"login":"yiisoft","id":993323,"avatar_url":"https://avatars.githubusercontent.com/u/993323?v=3","gravatar_id":"","url":"https://api.github.com/users/yiisoft","html_url":"https://github.com/yiisoft","followers_url":"https://api.github.com/users/yiisoft/followers","following_url":"https://api.github.com/users/yiisoft/following{/other_user}","gists_url":"https://api.github.com/users/yiisoft/gists{/gist_id}","starred_url":"https://api.github.com/users/yiisoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yiisoft/subscriptions","organizations_url":"https://api.github.com/users/yiisoft/orgs","repos_url":"https://api.github.com/users/yiisoft/repos","events_url":"https://api.github.com/users/yiisoft/events{/privacy}","received_events_url":"https://api.github.com/users/yiisoft/received_events","type":"Organization","site_admin":false},"repo":{"id":3431193,"name":"yii2","full_name":"yiisoft/yii2","owner":{"login":"yiisoft","id":993323,"avatar_url":"https://avatars.githubusercontent.com/u/993323?v=3","gravatar_id":"","url":"https://api.github.com/users/yiisoft","html_url":"https://github.com/yiisoft","followers_url":"https://api.github.com/users/yiisoft/followers","following_url":"https://api.github.com/users/yiisoft/following{/other_user}","gists_url":"https://api.github.com/users/yiisoft/gists{/gist_id}","starred_url":"https://api.github.com/users/yiisoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yiisoft/subscriptions","organizations_url":"https://api.github.com/users/yiisoft/orgs","repos_url":"https://api.github.com/users/yiisoft/repos","events_url":"https://api.github.com/users/yiisoft/events{/privacy}","received_events_url":"https://api.github.com/users/yiisoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yiisoft/yii2","description":"Yii 2 framework main development repo","fork":false,"url":"https://api.github.com/repos/yiisoft/yii2","forks_url":"https://api.github.com/repos/yiisoft/yii2/forks","keys_url":"https://api.github.com/repos/yiisoft/yii2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yiisoft/yii2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yiisoft/yii2/teams","hooks_url":"https://api.github.com/repos/yiisoft/yii2/hooks","issue_events_url":"https://api.github.com/repos/yiisoft/yii2/issues/events{/number}","events_url":"https://api.github.com/repos/yiisoft/yii2/events","assignees_url":"https://api.github.com/repos/yiisoft/yii2/assignees{/user}","branches_url":"https://api.github.com/repos/yiisoft/yii2/branches{/branch}","tags_url":"https://api.github.com/repos/yiisoft/yii2/tags","blobs_url":"https://api.github.com/repos/yiisoft/yii2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yiisoft/yii2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yiisoft/yii2/git/refs{/sha}","trees_url":"https://api.github.com/repos/yiisoft/yii2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yiisoft/yii2/statuses/{sha}","languages_url":"https://api.github.com/repos/yiisoft/yii2/languages","stargazers_url":"https://api.github.com/repos/yiisoft/yii2/stargazers","contributors_url":"https://api.github.com/repos/yiisoft/yii2/contributors","subscribers_url":"https://api.github.com/repos/yiisoft/yii2/subscribers","subscription_url":"https://api.github.com/repos/yiisoft/yii2/subscription","commits_url":"https://api.github.com/repos/yiisoft/yii2/commits{/sha}","git_commits_url":"https://api.github.com/repos/yiisoft/yii2/git/commits{/sha}","comments_url":"https://api.github.com/repos/yiisoft/yii2/comments{/number}","issue_comment_url":"https://api.github.com/repos/yiisoft/yii2/issues/comments/{number}","contents_url":"https://api.github.com/repos/yiisoft/yii2/contents/{+path}","compare_url":"https://api.github.com/repos/yiisoft/yii2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yiisoft/yii2/merges","archive_url":"https://api.github.com/repos/yiisoft/yii2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yiisoft/yii2/downloads","issues_url":"https://api.github.com/repos/yiisoft/yii2/issues{/number}","pulls_url":"https://api.github.com/repos/yiisoft/yii2/pulls{/number}","milestones_url":"https://api.github.com/repos/yiisoft/yii2/milestones{/number}","notifications_url":"https://api.github.com/repos/yiisoft/yii2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yiisoft/yii2/labels{/name}","releases_url":"https://api.github.com/repos/yiisoft/yii2/releases{/id}","created_at":"2012-02-13T15:32:36Z","updated_at":"2015-01-04T22:15:17Z","pushed_at":"2015-01-04T18:04:22Z","git_url":"git://github.com/yiisoft/yii2.git","ssh_url":"git@github.com:yiisoft/yii2.git","clone_url":"https://github.com/yiisoft/yii2.git","svn_url":"https://github.com/yiisoft/yii2","homepage":"http://www.yiiframework.com","size":75595,"stargazers_count":4545,"watchers_count":4545,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2303,"mirror_url":null,"open_issues_count":500,"forks":2303,"open_issues":500,"watchers":4545,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yiisoft/yii2/pulls/6634"},"html":{"href":"https://github.com/yiisoft/yii2/pull/6634"},"issue":{"href":"https://api.github.com/repos/yiisoft/yii2/issues/6634"},"comments":{"href":"https://api.github.com/repos/yiisoft/yii2/issues/6634/comments"},"review_comments":{"href":"https://api.github.com/repos/yiisoft/yii2/pulls/6634/comments"},"review_comment":{"href":"https://api.github.com/repos/yiisoft/yii2/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/yiisoft/yii2/pulls/6634/commits"},"statuses":{"href":"https://api.github.com/repos/yiisoft/yii2/statuses/1a33ecbcfb0cd8029602b39cb8c5f898295d9da1"}}}}