{"action":"closed","number":52,"pull_request":{"url":"https://api.github.com/repos/zendframework/zend-stratigility/pulls/52","id":63731196,"html_url":"https://github.com/zendframework/zend-stratigility/pull/52","diff_url":"https://github.com/zendframework/zend-stratigility/pull/52.diff","patch_url":"https://github.com/zendframework/zend-stratigility/pull/52.patch","issue_url":"https://api.github.com/repos/zendframework/zend-stratigility/issues/52","number":52,"state":"closed","locked":false,"title":"[BUG FIX] \"500 OK\" error responses","user":{"login":"michaelmoussa","id":183833,"avatar_url":"https://avatars.githubusercontent.com/u/183833?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelmoussa","html_url":"https://github.com/michaelmoussa","followers_url":"https://api.github.com/users/michaelmoussa/followers","following_url":"https://api.github.com/users/michaelmoussa/following{/other_user}","gists_url":"https://api.github.com/users/michaelmoussa/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelmoussa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelmoussa/subscriptions","organizations_url":"https://api.github.com/users/michaelmoussa/orgs","repos_url":"https://api.github.com/users/michaelmoussa/repos","events_url":"https://api.github.com/users/michaelmoussa/events{/privacy}","received_events_url":"https://api.github.com/users/michaelmoussa/received_events","type":"User","site_admin":false},"body":"This addresses the issue reported in #51.\r\n\r\n#46 ensured that response reason phrases set by developers would be preserved when building error responses. Unfortunately, it also ensured that reason phrases _NOT_ set by developers (i.e., \"OK\") would also be preserved.\r\n\r\nThis PR takes the following use cases into account. Let me know if I missed a possibility!\r\n\r\n1. **All is well and an exception is thrown:** Error response will have the status code corresponding to the code of the exception that was thrown (or 500 by default). Error response reason phrase will be whatever the HTTP standard is for the code that was chosen.\r\n2. **Response is already in an error state, then an exception is thrown**, which means either:\r\n    1. The application caught an exception, updated the response, then threw the same exception. If that's the case, then we assume the reason phrase was also updated, and we keep it.\r\n    2. The application encountered an error, updated the response, and then _something else_ happened before getting to the `FinalHandler` (maybe another middleware in the error middleware pipeline does some kind of logging or external error reporting, and that failed). In this case, the reason phrase will be preserved if the resulting exception doesn't change the status code. If it does, then there will be a new reason phrase. _**I expect this should be a rare occurrence**_, but at least there is a sane default behavior when it happens.","created_at":"2016-03-22T14:43:25Z","updated_at":"2016-03-24T21:19:04Z","closed_at":"2016-03-24T21:19:04Z","merged_at":"2016-03-24T21:19:04Z","merge_commit_sha":"e7d1b83e81e3de4dbbc91ffeb7dc8bc86b539412","assignee":{"login":"weierophinney","id":25943,"avatar_url":"https://avatars.githubusercontent.com/u/25943?v=3","gravatar_id":"","url":"https://api.github.com/users/weierophinney","html_url":"https://github.com/weierophinney","followers_url":"https://api.github.com/users/weierophinney/followers","following_url":"https://api.github.com/users/weierophinney/following{/other_user}","gists_url":"https://api.github.com/users/weierophinney/gists{/gist_id}","starred_url":"https://api.github.com/users/weierophinney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weierophinney/subscriptions","organizations_url":"https://api.github.com/users/weierophinney/orgs","repos_url":"https://api.github.com/users/weierophinney/repos","events_url":"https://api.github.com/users/weierophinney/events{/privacy}","received_events_url":"https://api.github.com/users/weierophinney/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/zendframework/zend-stratigility/milestones/9","html_url":"https://github.com/zendframework/zend-stratigility/milestones/1.2.1","labels_url":"https://api.github.com/repos/zendframework/zend-stratigility/milestones/9/labels","id":1664749,"number":9,"title":"1.2.1","description":null,"creator":{"login":"weierophinney","id":25943,"avatar_url":"https://avatars.githubusercontent.com/u/25943?v=3","gravatar_id":"","url":"https://api.github.com/users/weierophinney","html_url":"https://github.com/weierophinney","followers_url":"https://api.github.com/users/weierophinney/followers","following_url":"https://api.github.com/users/weierophinney/following{/other_user}","gists_url":"https://api.github.com/users/weierophinney/gists{/gist_id}","starred_url":"https://api.github.com/users/weierophinney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weierophinney/subscriptions","organizations_url":"https://api.github.com/users/weierophinney/orgs","repos_url":"https://api.github.com/users/weierophinney/repos","events_url":"https://api.github.com/users/weierophinney/events{/privacy}","received_events_url":"https://api.github.com/users/weierophinney/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":1,"state":"open","created_at":"2016-03-24T21:17:02Z","updated_at":"2016-03-24T21:19:04Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/zendframework/zend-stratigility/pulls/52/commits","review_comments_url":"https://api.github.com/repos/zendframework/zend-stratigility/pulls/52/comments","review_comment_url":"https://api.github.com/repos/zendframework/zend-stratigility/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zendframework/zend-stratigility/issues/52/comments","statuses_url":"https://api.github.com/repos/zendframework/zend-stratigility/statuses/e7d1b83e81e3de4dbbc91ffeb7dc8bc86b539412","head":{"label":"michaelmoussa:bugfix/51","ref":"bugfix/51","sha":"e7d1b83e81e3de4dbbc91ffeb7dc8bc86b539412","user":{"login":"michaelmoussa","id":183833,"avatar_url":"https://avatars.githubusercontent.com/u/183833?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelmoussa","html_url":"https://github.com/michaelmoussa","followers_url":"https://api.github.com/users/michaelmoussa/followers","following_url":"https://api.github.com/users/michaelmoussa/following{/other_user}","gists_url":"https://api.github.com/users/michaelmoussa/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelmoussa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelmoussa/subscriptions","organizations_url":"https://api.github.com/users/michaelmoussa/orgs","repos_url":"https://api.github.com/users/michaelmoussa/repos","events_url":"https://api.github.com/users/michaelmoussa/events{/privacy}","received_events_url":"https://api.github.com/users/michaelmoussa/received_events","type":"User","site_admin":false},"repo":{"id":50958792,"name":"zend-stratigility","full_name":"michaelmoussa/zend-stratigility","owner":{"login":"michaelmoussa","id":183833,"avatar_url":"https://avatars.githubusercontent.com/u/183833?v=3","gravatar_id":"","url":"https://api.github.com/users/michaelmoussa","html_url":"https://github.com/michaelmoussa","followers_url":"https://api.github.com/users/michaelmoussa/followers","following_url":"https://api.github.com/users/michaelmoussa/following{/other_user}","gists_url":"https://api.github.com/users/michaelmoussa/gists{/gist_id}","starred_url":"https://api.github.com/users/michaelmoussa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaelmoussa/subscriptions","organizations_url":"https://api.github.com/users/michaelmoussa/orgs","repos_url":"https://api.github.com/users/michaelmoussa/repos","events_url":"https://api.github.com/users/michaelmoussa/events{/privacy}","received_events_url":"https://api.github.com/users/michaelmoussa/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/michaelmoussa/zend-stratigility","description":"Middleware for PHP built on top of PSR-7","fork":true,"url":"https://api.github.com/repos/michaelmoussa/zend-stratigility","forks_url":"https://api.github.com/repos/michaelmoussa/zend-stratigility/forks","keys_url":"https://api.github.com/repos/michaelmoussa/zend-stratigility/keys{/key_id}","collaborators_url":"https://api.github.com/repos/michaelmoussa/zend-stratigility/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/michaelmoussa/zend-stratigility/teams","hooks_url":"https://api.github.com/repos/michaelmoussa/zend-stratigility/hooks","issue_events_url":"https://api.github.com/repos/michaelmoussa/zend-stratigility/issues/events{/number}","events_url":"https://api.github.com/repos/michaelmoussa/zend-stratigility/events","assignees_url":"https://api.github.com/repos/michaelmoussa/zend-stratigility/assignees{/user}","branches_url":"https://api.github.com/repos/michaelmoussa/zend-stratigility/branches{/branch}","tags_url":"https://api.github.com/repos/michaelmoussa/zend-stratigility/tags","blobs_url":"https://api.github.com/repos/michaelmoussa/zend-stratigility/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/michaelmoussa/zend-stratigility/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/michaelmoussa/zend-stratigility/git/refs{/sha}","trees_url":"https://api.github.com/repos/michaelmoussa/zend-stratigility/git/trees{/sha}","statuses_url":"https://api.github.com/repos/michaelmoussa/zend-stratigility/statuses/{sha}","languages_url":"https://api.github.com/repos/michaelmoussa/zend-stratigility/languages","stargazers_url":"https://api.github.com/repos/michaelmoussa/zend-stratigility/stargazers","contributors_url":"https://api.github.com/repos/michaelmoussa/zend-stratigility/contributors","subscribers_url":"https://api.github.com/repos/michaelmoussa/zend-stratigility/subscribers","subscription_url":"https://api.github.com/repos/michaelmoussa/zend-stratigility/subscription","commits_url":"https://api.github.com/repos/michaelmoussa/zend-stratigility/commits{/sha}","git_commits_url":"https://api.github.com/repos/michaelmoussa/zend-stratigility/git/commits{/sha}","comments_url":"https://api.github.com/repos/michaelmoussa/zend-stratigility/comments{/number}","issue_comment_url":"https://api.github.com/repos/michaelmoussa/zend-stratigility/issues/comments{/number}","contents_url":"https://api.github.com/repos/michaelmoussa/zend-stratigility/contents/{+path}","compare_url":"https://api.github.com/repos/michaelmoussa/zend-stratigility/compare/{base}...{head}","merges_url":"https://api.github.com/repos/michaelmoussa/zend-stratigility/merges","archive_url":"https://api.github.com/repos/michaelmoussa/zend-stratigility/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/michaelmoussa/zend-stratigility/downloads","issues_url":"https://api.github.com/repos/michaelmoussa/zend-stratigility/issues{/number}","pulls_url":"https://api.github.com/repos/michaelmoussa/zend-stratigility/pulls{/number}","milestones_url":"https://api.github.com/repos/michaelmoussa/zend-stratigility/milestones{/number}","notifications_url":"https://api.github.com/repos/michaelmoussa/zend-stratigility/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/michaelmoussa/zend-stratigility/labels{/name}","releases_url":"https://api.github.com/repos/michaelmoussa/zend-stratigility/releases{/id}","deployments_url":"https://api.github.com/repos/michaelmoussa/zend-stratigility/deployments","created_at":"2016-02-02T23:13:45Z","updated_at":"2016-02-02T23:13:46Z","pushed_at":"2016-03-22T14:46:57Z","git_url":"git://github.com/michaelmoussa/zend-stratigility.git","ssh_url":"git@github.com:michaelmoussa/zend-stratigility.git","clone_url":"https://github.com/michaelmoussa/zend-stratigility.git","svn_url":"https://github.com/michaelmoussa/zend-stratigility","homepage":null,"size":311,"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":"zendframework:master","ref":"master","sha":"0c5903a54d407ef1e5afcedf22c8cd28366177ef","user":{"login":"zendframework","id":296074,"avatar_url":"https://avatars.githubusercontent.com/u/296074?v=3","gravatar_id":"","url":"https://api.github.com/users/zendframework","html_url":"https://github.com/zendframework","followers_url":"https://api.github.com/users/zendframework/followers","following_url":"https://api.github.com/users/zendframework/following{/other_user}","gists_url":"https://api.github.com/users/zendframework/gists{/gist_id}","starred_url":"https://api.github.com/users/zendframework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zendframework/subscriptions","organizations_url":"https://api.github.com/users/zendframework/orgs","repos_url":"https://api.github.com/users/zendframework/repos","events_url":"https://api.github.com/users/zendframework/events{/privacy}","received_events_url":"https://api.github.com/users/zendframework/received_events","type":"Organization","site_admin":false},"repo":{"id":36027437,"name":"zend-stratigility","full_name":"zendframework/zend-stratigility","owner":{"login":"zendframework","id":296074,"avatar_url":"https://avatars.githubusercontent.com/u/296074?v=3","gravatar_id":"","url":"https://api.github.com/users/zendframework","html_url":"https://github.com/zendframework","followers_url":"https://api.github.com/users/zendframework/followers","following_url":"https://api.github.com/users/zendframework/following{/other_user}","gists_url":"https://api.github.com/users/zendframework/gists{/gist_id}","starred_url":"https://api.github.com/users/zendframework/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zendframework/subscriptions","organizations_url":"https://api.github.com/users/zendframework/orgs","repos_url":"https://api.github.com/users/zendframework/repos","events_url":"https://api.github.com/users/zendframework/events{/privacy}","received_events_url":"https://api.github.com/users/zendframework/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zendframework/zend-stratigility","description":"Middleware for PHP built on top of PSR-7","fork":false,"url":"https://api.github.com/repos/zendframework/zend-stratigility","forks_url":"https://api.github.com/repos/zendframework/zend-stratigility/forks","keys_url":"https://api.github.com/repos/zendframework/zend-stratigility/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zendframework/zend-stratigility/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zendframework/zend-stratigility/teams","hooks_url":"https://api.github.com/repos/zendframework/zend-stratigility/hooks","issue_events_url":"https://api.github.com/repos/zendframework/zend-stratigility/issues/events{/number}","events_url":"https://api.github.com/repos/zendframework/zend-stratigility/events","assignees_url":"https://api.github.com/repos/zendframework/zend-stratigility/assignees{/user}","branches_url":"https://api.github.com/repos/zendframework/zend-stratigility/branches{/branch}","tags_url":"https://api.github.com/repos/zendframework/zend-stratigility/tags","blobs_url":"https://api.github.com/repos/zendframework/zend-stratigility/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zendframework/zend-stratigility/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zendframework/zend-stratigility/git/refs{/sha}","trees_url":"https://api.github.com/repos/zendframework/zend-stratigility/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zendframework/zend-stratigility/statuses/{sha}","languages_url":"https://api.github.com/repos/zendframework/zend-stratigility/languages","stargazers_url":"https://api.github.com/repos/zendframework/zend-stratigility/stargazers","contributors_url":"https://api.github.com/repos/zendframework/zend-stratigility/contributors","subscribers_url":"https://api.github.com/repos/zendframework/zend-stratigility/subscribers","subscription_url":"https://api.github.com/repos/zendframework/zend-stratigility/subscription","commits_url":"https://api.github.com/repos/zendframework/zend-stratigility/commits{/sha}","git_commits_url":"https://api.github.com/repos/zendframework/zend-stratigility/git/commits{/sha}","comments_url":"https://api.github.com/repos/zendframework/zend-stratigility/comments{/number}","issue_comment_url":"https://api.github.com/repos/zendframework/zend-stratigility/issues/comments{/number}","contents_url":"https://api.github.com/repos/zendframework/zend-stratigility/contents/{+path}","compare_url":"https://api.github.com/repos/zendframework/zend-stratigility/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zendframework/zend-stratigility/merges","archive_url":"https://api.github.com/repos/zendframework/zend-stratigility/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zendframework/zend-stratigility/downloads","issues_url":"https://api.github.com/repos/zendframework/zend-stratigility/issues{/number}","pulls_url":"https://api.github.com/repos/zendframework/zend-stratigility/pulls{/number}","milestones_url":"https://api.github.com/repos/zendframework/zend-stratigility/milestones{/number}","notifications_url":"https://api.github.com/repos/zendframework/zend-stratigility/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zendframework/zend-stratigility/labels{/name}","releases_url":"https://api.github.com/repos/zendframework/zend-stratigility/releases{/id}","deployments_url":"https://api.github.com/repos/zendframework/zend-stratigility/deployments","created_at":"2015-05-21T17:32:20Z","updated_at":"2016-03-24T18:40:56Z","pushed_at":"2016-03-24T21:19:04Z","git_url":"git://github.com/zendframework/zend-stratigility.git","ssh_url":"git@github.com:zendframework/zend-stratigility.git","clone_url":"https://github.com/zendframework/zend-stratigility.git","svn_url":"https://github.com/zendframework/zend-stratigility","homepage":null,"size":331,"stargazers_count":128,"watchers_count":128,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":29,"mirror_url":null,"open_issues_count":6,"forks":29,"open_issues":6,"watchers":128,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zendframework/zend-stratigility/pulls/52"},"html":{"href":"https://github.com/zendframework/zend-stratigility/pull/52"},"issue":{"href":"https://api.github.com/repos/zendframework/zend-stratigility/issues/52"},"comments":{"href":"https://api.github.com/repos/zendframework/zend-stratigility/issues/52/comments"},"review_comments":{"href":"https://api.github.com/repos/zendframework/zend-stratigility/pulls/52/comments"},"review_comment":{"href":"https://api.github.com/repos/zendframework/zend-stratigility/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zendframework/zend-stratigility/pulls/52/commits"},"statuses":{"href":"https://api.github.com/repos/zendframework/zend-stratigility/statuses/e7d1b83e81e3de4dbbc91ffeb7dc8bc86b539412"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"weierophinney","id":25943,"avatar_url":"https://avatars.githubusercontent.com/u/25943?v=3","gravatar_id":"","url":"https://api.github.com/users/weierophinney","html_url":"https://github.com/weierophinney","followers_url":"https://api.github.com/users/weierophinney/followers","following_url":"https://api.github.com/users/weierophinney/following{/other_user}","gists_url":"https://api.github.com/users/weierophinney/gists{/gist_id}","starred_url":"https://api.github.com/users/weierophinney/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weierophinney/subscriptions","organizations_url":"https://api.github.com/users/weierophinney/orgs","repos_url":"https://api.github.com/users/weierophinney/repos","events_url":"https://api.github.com/users/weierophinney/events{/privacy}","received_events_url":"https://api.github.com/users/weierophinney/received_events","type":"User","site_admin":false},"comments":0,"review_comments":0,"commits":1,"additions":34,"deletions":7,"changed_files":2}}