{"action":"opened","issue":{"url":"https://api.github.com/repos/symfony/symfony/issues/16432","labels_url":"https://api.github.com/repos/symfony/symfony/issues/16432/labels{/name}","comments_url":"https://api.github.com/repos/symfony/symfony/issues/16432/comments","events_url":"https://api.github.com/repos/symfony/symfony/issues/16432/events","html_url":"https://github.com/symfony/symfony/issues/16432","id":114732659,"number":16432,"title":"Fatal Error Thrown for Untrusted Hosts","user":{"login":"jeremylivingston","id":472956,"avatar_url":"https://avatars.githubusercontent.com/u/472956?v=3","gravatar_id":"","url":"https://api.github.com/users/jeremylivingston","html_url":"https://github.com/jeremylivingston","followers_url":"https://api.github.com/users/jeremylivingston/followers","following_url":"https://api.github.com/users/jeremylivingston/following{/other_user}","gists_url":"https://api.github.com/users/jeremylivingston/gists{/gist_id}","starred_url":"https://api.github.com/users/jeremylivingston/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeremylivingston/subscriptions","organizations_url":"https://api.github.com/users/jeremylivingston/orgs","repos_url":"https://api.github.com/users/jeremylivingston/repos","events_url":"https://api.github.com/users/jeremylivingston/events{/privacy}","received_events_url":"https://api.github.com/users/jeremylivingston/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-11-03T02:55:36Z","updated_at":"2015-11-03T02:55:36Z","closed_at":null,"body":"In applications that have `trusted_hosts` set, it is possible for Symfony to throw the same exception twice, causing a fatal error.\r\n\r\nI began receiving the following error when upgrading to the latest version of Monolog (1.17.2):\r\n\r\n> PHP message: PHP Fatal error:  Method Symfony\\Component\\HttpFoundation\\Request::__toString() must not throw an exception in cache/production/classes.php on line 0\r\n\r\nUpon further research, it seems this only happens when an untrusted host attempts to access the application and when Monolog attempts to log the error. The full stack trace is as follows:\r\n\r\n```\r\nin classes.php line 0\r\nat NormalizerFormatter->normalize() in classes.php line 724\r\nat NormalizerFormatter->normalize() in classes.php line 724\r\nat NormalizerFormatter->normalize() in classes.php line 724\r\nat NormalizerFormatter->normalize() in classes.php line 724\r\nat NormalizerFormatter->normalize() in classes.php line 724\r\nat NormalizerFormatter->normalize() in classes.php line 694\r\nat NormalizerFormatter->format() in classes.php line 838\r\nat LineFormatter->format() in classes.php line 1022\r\nat AbstractProcessingHandler->handle() in classes.php line 1507\r\nat Logger->addRecord() in classes.php line 1576\r\nat Logger->log() in ErrorHandler.php line 490\r\nat ErrorHandler->handleException() in ErrorHandler.php line 0\r\n```\r\n\r\nIt seems that Monolog attempts to log `Symfony\\Component\\HttpFoundation\\Request` as a string, which [sends another call](https://github.com/symfony/symfony/blob/v2.7.6/src/Symfony/Component/HttpFoundation/Request.php#L501) to `$this->getRequestUri()` and, thus, triggers the same exception a second time.\r\n\r\nI'd be happy to fix the error if there is a recommended route for addressing the issue."}}