Seldaek/monolog — pull request #360 by hver (2014-04-23 12:24:04+00:00)
Title: ChromePhpHandler and FirePhpHandler should send no headers if no User-Agent is set

**ChromePhpHandler** and **FirePhpHandler** try to send their info to browser only when the `User-Agent` request header matches against 'Chrome' or respectively 'FirePhp'. But the problem is: when the User-Agent is not set, these handlers just output everything. You can easily test it with `wget -v -d -O /dev/null --user-agent="" http://example.com`, you'll get `X-ChromeLogger-Data` and `X-Wf-*` headers.

In our case, we've got an error on our development server, where both handlers are active (for testing in Chrome and FF). The dev server is behind the HAProxy, and HAProxy sets no User-Agent. Because of this, all the ChromePhp and FirePhp headers are sent, and the headers size exceeds 8KB, which leads to 502 error from HAProxy.

I tried to make unit tests for this feature, but the existing unit tests has to be refactored to use mocks, instead of just extending the handler and overwriting the functions. If you think, that this PR makes sense, then I can do it. Also I would like to make some performance changes, because now, even if the headers shall not be send, the whole message got processed, etc.

**Question:** why is the property `protected static $sendHeaders = true;` (FirePhpHandler:54) static? If I understand correctly, there are two magic methods present (`__get` and `__set`) only because of this static property. Wouldn't it be much easier to just make this property non-static?