Skip to content

Commit

Permalink
[MonologBridge] Adjust for Monolog 1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Oct 24, 2011
1 parent cbb4bba commit 27d0809
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/Symfony/Bridge/Monolog/Handler/FirePHPHandler.php
Expand Up @@ -42,6 +42,12 @@ public function onKernelResponse(FilterResponseEvent $event)
return;
}

if (!preg_match('{\bFirePHP/\d+\.\d+\b}', $event->getRequest()->headers->get('User-Agent'))) {
$this->sendHeaders = false;
$this->headers = array();
return;
}

$this->response = $event->getResponse();
foreach ($this->headers as $header => $content) {
$this->response->headers->set($header, $content);
Expand All @@ -54,10 +60,22 @@ public function onKernelResponse(FilterResponseEvent $event)
*/
protected function sendHeader($header, $content)
{
if (!$this->sendHeaders) {
return;
}

if ($this->response) {
$this->response->headers->set($header, $content);
} else {
$this->headers[$header] = $content;
}
}

/**
* Override default behavior since we check the user agent in onKernelResponse
*/
protected function headersAccepted()
{
return true;
}
}

0 comments on commit 27d0809

Please sign in to comment.