{"action":"opened","issue":{"url":"https://api.github.com/repos/guzzle/psr7/issues/95","repository_url":"https://api.github.com/repos/guzzle/psr7","labels_url":"https://api.github.com/repos/guzzle/psr7/issues/95/labels{/name}","comments_url":"https://api.github.com/repos/guzzle/psr7/issues/95/comments","events_url":"https://api.github.com/repos/guzzle/psr7/issues/95/events","html_url":"https://github.com/guzzle/psr7/issues/95","id":158720723,"number":95,"title":"Unable to read response's body contents","user":{"login":"SilverFire","id":4499203,"avatar_url":"https://avatars.githubusercontent.com/u/4499203?v=3","gravatar_id":"","url":"https://api.github.com/users/SilverFire","html_url":"https://github.com/SilverFire","followers_url":"https://api.github.com/users/SilverFire/followers","following_url":"https://api.github.com/users/SilverFire/following{/other_user}","gists_url":"https://api.github.com/users/SilverFire/gists{/gist_id}","starred_url":"https://api.github.com/users/SilverFire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SilverFire/subscriptions","organizations_url":"https://api.github.com/users/SilverFire/orgs","repos_url":"https://api.github.com/users/SilverFire/repos","events_url":"https://api.github.com/users/SilverFire/events{/privacy}","received_events_url":"https://api.github.com/users/SilverFire/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-06-06T16:35:27Z","updated_at":"2016-06-06T16:35:27Z","closed_at":null,"body":"Commit https://github.com/guzzle/psr7/commit/45054d91c290de494549511e470ef5853f726a50#diff-f89246dce7e387482b2c6c584a5e7e9dR97 introduced a bug by comparing `$body` with empty string.\r\n\r\nI did not dig too deeply to find out the real reason of wrong behavior, but I guess it is caused by implicit calling of `GuzzleHttp\\Psr7\\Stream::__toString()` in order to cast object to string to make a comparison.\r\n\r\n### How to reproduce\r\n\r\n```php\r\n        $client = new \\GuzzleHttp\\Client(['base_uri' => 'https://google.com.ua/']);\r\n        $response = $client->request('GET');\r\n        $html = $response->getBody()->getContents();\r\n```\r\n\r\n### What is expected\r\n\r\n`$html` contains a response HTML\r\n\r\n### What do we have instead\r\n\r\n`$html` is an empty string\r\n\r\n### Patch?\r\n\r\nRolling back that line to `if ($body !== null)` fixes the problem. Not sure whether it is a proper fix.\r\n\r\n### Environment\r\n\r\nPHP 5.6.20\r\nUbuntu 16.04\r\nguzzle/psr7@dev-master \r\n"}}
{"actor":{"display_login":"SilverFire"}}