{"action":"created","comment":{"url":"https://api.github.com/repos/owncloud/core/pulls/comments/25172192","id":25172192,"diff_hunk":"@@ -43,20 +43,52 @@ public function __construct(IConfig $config, ISession $session) {\n \tpublic function getTimeZone() {\n \t\t$timeZone = $this->config->getUserValue($this->session->get('user_id'), 'core', 'timezone', null);\n \t\tif ($timeZone === null) {\n+\t\t\t$timeZone = 'UTC';\n \t\t\tif ($this->session->exists('timezone')) {\n \t\t\t\t$offsetHours = $this->session->get('timezone');\n-\t\t\t\t// Note: the timeZone name is the inverse to the offset,\n-\t\t\t\t// so a positive offset means negative timeZone\n-\t\t\t\t// and the other way around.\n-\t\t\t\tif ($offsetHours > 0) {\n-\t\t\t\t\treturn new \\DateTimeZone('Etc/GMT-' . $offsetHours);\n-\t\t\t\t} else {\n-\t\t\t\t\treturn new \\DateTimeZone('Etc/GMT+' . abs($offsetHours));\n-\t\t\t\t}\n-\t\t\t} else {\n-\t\t\t\treturn new \\DateTimeZone('UTC');\n+\t\t\t\t$timeZone = $this->getTimeZoneFromOffset($offsetHours);\n \t\t\t}\n \t\t}\n-\t\treturn new \\DateTimeZone($timeZone);\n+\n+\t\ttry {\n+\t\t\treturn new \\DateTimeZone($timeZone);\n+\t\t} catch (\\Exception $e) {\n+\t\t\t\\OCP\\Util::writeLog('datetimezone', 'Failed to created DateTimeZone \"' . $timeZone . \"'\", \\OCP\\Util::DEBUG);\n+\t\t\treturn new \\DateTimeZone('UTC');\n+\t\t}\n+\t}\n+\n+\tprotected function getTimeZoneFromOffset($offset) {\n+\t\tif (is_int($offset)) {","path":"lib/private/datetimezone.php","position":31,"original_position":31,"commit_id":"f3cf7ef8f18fa9c7af4d047ad4bafa7cf04e391d","original_commit_id":"f3cf7ef8f18fa9c7af4d047ad4bafa7cf04e391d","user":{"login":"bantu","id":189375,"avatar_url":"https://avatars.githubusercontent.com/u/189375?v=3","gravatar_id":"","url":"https://api.github.com/users/bantu","html_url":"https://github.com/bantu","followers_url":"https://api.github.com/users/bantu/followers","following_url":"https://api.github.com/users/bantu/following{/other_user}","gists_url":"https://api.github.com/users/bantu/gists{/gist_id}","starred_url":"https://api.github.com/users/bantu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bantu/subscriptions","organizations_url":"https://api.github.com/users/bantu/orgs","repos_url":"https://api.github.com/users/bantu/repos","events_url":"https://api.github.com/users/bantu/events{/privacy}","received_events_url":"https://api.github.com/users/bantu/received_events","type":"User","site_admin":false},"body":"is_int() is a type check. Especially is_int('0') is false.","created_at":"2015-02-23T15:30:15Z","updated_at":"2015-02-23T15:30:15Z","html_url":"https://github.com/owncloud/core/pull/14429#discussion_r25172192","pull_request_url":"https://api.github.com/repos/owncloud/core/pulls/14429","_links":{"self":{"href":"https://api.github.com/repos/owncloud/core/pulls/comments/25172192"},"html":{"href":"https://github.com/owncloud/core/pull/14429#discussion_r25172192"},"pull_request":{"href":"https://api.github.com/repos/owncloud/core/pulls/14429"}}},"pull_request":{"url":"https://api.github.com/repos/owncloud/core/pulls/14429","id":29802639,"html_url":"https://github.com/owncloud/core/pull/14429","diff_url":"https://github.com/owncloud/core/pull/14429.diff","patch_url":"https://github.com/owncloud/core/pull/14429.patch","issue_url":"https://api.github.com/repos/owncloud/core/issues/14429","number":14429,"state":"open","locked":false,"title":"Etc timezones don't exist for .5 and .75 offsets","user":{"login":"nickvergessen","id":213943,"avatar_url":"https://avatars.githubusercontent.com/u/213943?v=3","gravatar_id":"","url":"https://api.github.com/users/nickvergessen","html_url":"https://github.com/nickvergessen","followers_url":"https://api.github.com/users/nickvergessen/followers","following_url":"https://api.github.com/users/nickvergessen/following{/other_user}","gists_url":"https://api.github.com/users/nickvergessen/gists{/gist_id}","starred_url":"https://api.github.com/users/nickvergessen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nickvergessen/subscriptions","organizations_url":"https://api.github.com/users/nickvergessen/orgs","repos_url":"https://api.github.com/users/nickvergessen/repos","events_url":"https://api.github.com/users/nickvergessen/events{/privacy}","received_events_url":"https://api.github.com/users/nickvergessen/received_events","type":"User","site_admin":false},"body":"Fix #14176, #14391 \r\n\r\n@phritter @rinchen @bit can you test this please?\r\n\r\ncc @LukasReschke \r\n\r\n@DeepDiver1975 should backport\r\n\r\n### To test:\r\n1. Change your local Computer timezone to `Asia/Kathmandu`\r\n2. Log in into ownCloud\r\n3. Create a folder to trigger an activity\r\n4. Wait until the activity email is sent, or force it by setting `oc_activity_mq`.`amq_latest_send` to `1` for the entry aswell as `oc_jobs`.`last_run` for `OCA\\Activity\\BackgroundJob\\EmailNotification`","created_at":"2015-02-23T11:47:31Z","updated_at":"2015-02-23T15:30:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f7b96b4d2ab8e6c4b421859f86d8c67cca987c50","assignee":null,"milestone":{"url":"https://api.github.com/repos/owncloud/core/milestones/31","labels_url":"https://api.github.com/repos/owncloud/core/milestones/31/labels","id":912160,"number":31,"title":"8.1-next","description":"","creator":{"login":"MorrisJobke","id":245432,"avatar_url":"https://avatars.githubusercontent.com/u/245432?v=3","gravatar_id":"","url":"https://api.github.com/users/MorrisJobke","html_url":"https://github.com/MorrisJobke","followers_url":"https://api.github.com/users/MorrisJobke/followers","following_url":"https://api.github.com/users/MorrisJobke/following{/other_user}","gists_url":"https://api.github.com/users/MorrisJobke/gists{/gist_id}","starred_url":"https://api.github.com/users/MorrisJobke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MorrisJobke/subscriptions","organizations_url":"https://api.github.com/users/MorrisJobke/orgs","repos_url":"https://api.github.com/users/MorrisJobke/repos","events_url":"https://api.github.com/users/MorrisJobke/events{/privacy}","received_events_url":"https://api.github.com/users/MorrisJobke/received_events","type":"User","site_admin":false},"open_issues":369,"closed_issues":149,"state":"open","created_at":"2014-12-22T12:04:01Z","updated_at":"2015-02-23T15:03:32Z","due_on":"2015-04-02T22:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/owncloud/core/pulls/14429/commits","review_comments_url":"https://api.github.com/repos/owncloud/core/pulls/14429/comments","review_comment_url":"https://api.github.com/repos/owncloud/core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/owncloud/core/issues/14429/comments","statuses_url":"https://api.github.com/repos/owncloud/core/statuses/f3cf7ef8f18fa9c7af4d047ad4bafa7cf04e391d","head":{"label":"owncloud:issue/14176-validate-timezone-before-using","ref":"issue/14176-validate-timezone-before-using","sha":"f3cf7ef8f18fa9c7af4d047ad4bafa7cf04e391d","user":{"login":"owncloud","id":1645051,"avatar_url":"https://avatars.githubusercontent.com/u/1645051?v=3","gravatar_id":"","url":"https://api.github.com/users/owncloud","html_url":"https://github.com/owncloud","followers_url":"https://api.github.com/users/owncloud/followers","following_url":"https://api.github.com/users/owncloud/following{/other_user}","gists_url":"https://api.github.com/users/owncloud/gists{/gist_id}","starred_url":"https://api.github.com/users/owncloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/owncloud/subscriptions","organizations_url":"https://api.github.com/users/owncloud/orgs","repos_url":"https://api.github.com/users/owncloud/repos","events_url":"https://api.github.com/users/owncloud/events{/privacy}","received_events_url":"https://api.github.com/users/owncloud/received_events","type":"Organization","site_admin":false},"repo":{"id":5550552,"name":"core","full_name":"owncloud/core","owner":{"login":"owncloud","id":1645051,"avatar_url":"https://avatars.githubusercontent.com/u/1645051?v=3","gravatar_id":"","url":"https://api.github.com/users/owncloud","html_url":"https://github.com/owncloud","followers_url":"https://api.github.com/users/owncloud/followers","following_url":"https://api.github.com/users/owncloud/following{/other_user}","gists_url":"https://api.github.com/users/owncloud/gists{/gist_id}","starred_url":"https://api.github.com/users/owncloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/owncloud/subscriptions","organizations_url":"https://api.github.com/users/owncloud/orgs","repos_url":"https://api.github.com/users/owncloud/repos","events_url":"https://api.github.com/users/owncloud/events{/privacy}","received_events_url":"https://api.github.com/users/owncloud/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/owncloud/core","description":"The ownCloud core","fork":false,"url":"https://api.github.com/repos/owncloud/core","forks_url":"https://api.github.com/repos/owncloud/core/forks","keys_url":"https://api.github.com/repos/owncloud/core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/owncloud/core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/owncloud/core/teams","hooks_url":"https://api.github.com/repos/owncloud/core/hooks","issue_events_url":"https://api.github.com/repos/owncloud/core/issues/events{/number}","events_url":"https://api.github.com/repos/owncloud/core/events","assignees_url":"https://api.github.com/repos/owncloud/core/assignees{/user}","branches_url":"https://api.github.com/repos/owncloud/core/branches{/branch}","tags_url":"https://api.github.com/repos/owncloud/core/tags","blobs_url":"https://api.github.com/repos/owncloud/core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/owncloud/core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/owncloud/core/git/refs{/sha}","trees_url":"https://api.github.com/repos/owncloud/core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/owncloud/core/statuses/{sha}","languages_url":"https://api.github.com/repos/owncloud/core/languages","stargazers_url":"https://api.github.com/repos/owncloud/core/stargazers","contributors_url":"https://api.github.com/repos/owncloud/core/contributors","subscribers_url":"https://api.github.com/repos/owncloud/core/subscribers","subscription_url":"https://api.github.com/repos/owncloud/core/subscription","commits_url":"https://api.github.com/repos/owncloud/core/commits{/sha}","git_commits_url":"https://api.github.com/repos/owncloud/core/git/commits{/sha}","comments_url":"https://api.github.com/repos/owncloud/core/comments{/number}","issue_comment_url":"https://api.github.com/repos/owncloud/core/issues/comments{/number}","contents_url":"https://api.github.com/repos/owncloud/core/contents/{+path}","compare_url":"https://api.github.com/repos/owncloud/core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/owncloud/core/merges","archive_url":"https://api.github.com/repos/owncloud/core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/owncloud/core/downloads","issues_url":"https://api.github.com/repos/owncloud/core/issues{/number}","pulls_url":"https://api.github.com/repos/owncloud/core/pulls{/number}","milestones_url":"https://api.github.com/repos/owncloud/core/milestones{/number}","notifications_url":"https://api.github.com/repos/owncloud/core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/owncloud/core/labels{/name}","releases_url":"https://api.github.com/repos/owncloud/core/releases{/id}","created_at":"2012-08-25T10:32:48Z","updated_at":"2015-02-23T15:29:46Z","pushed_at":"2015-02-23T15:29:47Z","git_url":"git://github.com/owncloud/core.git","ssh_url":"git@github.com:owncloud/core.git","clone_url":"https://github.com/owncloud/core.git","svn_url":"https://github.com/owncloud/core","homepage":null,"size":885220,"stargazers_count":3052,"watchers_count":3052,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":993,"mirror_url":null,"open_issues_count":1859,"forks":993,"open_issues":1859,"watchers":3052,"default_branch":"master"}},"base":{"label":"owncloud:master","ref":"master","sha":"f693d439e24c1d59c0de2347d6c9888c852cfafe","user":{"login":"owncloud","id":1645051,"avatar_url":"https://avatars.githubusercontent.com/u/1645051?v=3","gravatar_id":"","url":"https://api.github.com/users/owncloud","html_url":"https://github.com/owncloud","followers_url":"https://api.github.com/users/owncloud/followers","following_url":"https://api.github.com/users/owncloud/following{/other_user}","gists_url":"https://api.github.com/users/owncloud/gists{/gist_id}","starred_url":"https://api.github.com/users/owncloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/owncloud/subscriptions","organizations_url":"https://api.github.com/users/owncloud/orgs","repos_url":"https://api.github.com/users/owncloud/repos","events_url":"https://api.github.com/users/owncloud/events{/privacy}","received_events_url":"https://api.github.com/users/owncloud/received_events","type":"Organization","site_admin":false},"repo":{"id":5550552,"name":"core","full_name":"owncloud/core","owner":{"login":"owncloud","id":1645051,"avatar_url":"https://avatars.githubusercontent.com/u/1645051?v=3","gravatar_id":"","url":"https://api.github.com/users/owncloud","html_url":"https://github.com/owncloud","followers_url":"https://api.github.com/users/owncloud/followers","following_url":"https://api.github.com/users/owncloud/following{/other_user}","gists_url":"https://api.github.com/users/owncloud/gists{/gist_id}","starred_url":"https://api.github.com/users/owncloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/owncloud/subscriptions","organizations_url":"https://api.github.com/users/owncloud/orgs","repos_url":"https://api.github.com/users/owncloud/repos","events_url":"https://api.github.com/users/owncloud/events{/privacy}","received_events_url":"https://api.github.com/users/owncloud/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/owncloud/core","description":"The ownCloud core","fork":false,"url":"https://api.github.com/repos/owncloud/core","forks_url":"https://api.github.com/repos/owncloud/core/forks","keys_url":"https://api.github.com/repos/owncloud/core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/owncloud/core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/owncloud/core/teams","hooks_url":"https://api.github.com/repos/owncloud/core/hooks","issue_events_url":"https://api.github.com/repos/owncloud/core/issues/events{/number}","events_url":"https://api.github.com/repos/owncloud/core/events","assignees_url":"https://api.github.com/repos/owncloud/core/assignees{/user}","branches_url":"https://api.github.com/repos/owncloud/core/branches{/branch}","tags_url":"https://api.github.com/repos/owncloud/core/tags","blobs_url":"https://api.github.com/repos/owncloud/core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/owncloud/core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/owncloud/core/git/refs{/sha}","trees_url":"https://api.github.com/repos/owncloud/core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/owncloud/core/statuses/{sha}","languages_url":"https://api.github.com/repos/owncloud/core/languages","stargazers_url":"https://api.github.com/repos/owncloud/core/stargazers","contributors_url":"https://api.github.com/repos/owncloud/core/contributors","subscribers_url":"https://api.github.com/repos/owncloud/core/subscribers","subscription_url":"https://api.github.com/repos/owncloud/core/subscription","commits_url":"https://api.github.com/repos/owncloud/core/commits{/sha}","git_commits_url":"https://api.github.com/repos/owncloud/core/git/commits{/sha}","comments_url":"https://api.github.com/repos/owncloud/core/comments{/number}","issue_comment_url":"https://api.github.com/repos/owncloud/core/issues/comments{/number}","contents_url":"https://api.github.com/repos/owncloud/core/contents/{+path}","compare_url":"https://api.github.com/repos/owncloud/core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/owncloud/core/merges","archive_url":"https://api.github.com/repos/owncloud/core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/owncloud/core/downloads","issues_url":"https://api.github.com/repos/owncloud/core/issues{/number}","pulls_url":"https://api.github.com/repos/owncloud/core/pulls{/number}","milestones_url":"https://api.github.com/repos/owncloud/core/milestones{/number}","notifications_url":"https://api.github.com/repos/owncloud/core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/owncloud/core/labels{/name}","releases_url":"https://api.github.com/repos/owncloud/core/releases{/id}","created_at":"2012-08-25T10:32:48Z","updated_at":"2015-02-23T15:29:46Z","pushed_at":"2015-02-23T15:29:47Z","git_url":"git://github.com/owncloud/core.git","ssh_url":"git@github.com:owncloud/core.git","clone_url":"https://github.com/owncloud/core.git","svn_url":"https://github.com/owncloud/core","homepage":null,"size":885220,"stargazers_count":3052,"watchers_count":3052,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":993,"mirror_url":null,"open_issues_count":1859,"forks":993,"open_issues":1859,"watchers":3052,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/owncloud/core/pulls/14429"},"html":{"href":"https://github.com/owncloud/core/pull/14429"},"issue":{"href":"https://api.github.com/repos/owncloud/core/issues/14429"},"comments":{"href":"https://api.github.com/repos/owncloud/core/issues/14429/comments"},"review_comments":{"href":"https://api.github.com/repos/owncloud/core/pulls/14429/comments"},"review_comment":{"href":"https://api.github.com/repos/owncloud/core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/owncloud/core/pulls/14429/commits"},"statuses":{"href":"https://api.github.com/repos/owncloud/core/statuses/f3cf7ef8f18fa9c7af4d047ad4bafa7cf04e391d"}}}}