|
@@ -14,6 +14,7 @@ namespace Symfony\Bundle\MonologBundle\Logger;
|
|
use Monolog\Handler\FirePHPHandler as BaseFirePHPHandler;
|
|
use Monolog\Handler\FirePHPHandler as BaseFirePHPHandler;
|
|
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
|
|
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
|
|
+use Symfony\Component\HttpKernel\HttpKernelInterface;
|
|
|
|
|
|
/**
|
|
/**
|
|
* FirePHPHandler.
|
|
* FirePHPHandler.
|
|
@@ -33,26 +34,30 @@ class FirePHPHandler extends BaseFirePHPHandler
|
|
private $response;
|
|
private $response;
|
|
|
|
|
|
/**
|
|
/**
|
|
- * {@inheritDoc}
|
|
|
|
|
|
+ * Adds the headers to the response once it's created
|
|
*/
|
|
*/
|
|
- protected function sendHeader($header, $content)
|
|
|
|
|
|
+ public function onCoreResponse(FilterResponseEvent $event)
|
|
{
|
|
{
|
|
- if ($this->response) {
|
|
|
|
|
|
+ if (HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $this->response = $event->getResponse();
|
|
|
|
+ foreach ($this->headers as $header => $content) {
|
|
$this->response->headers->set($header, $content);
|
|
$this->response->headers->set($header, $content);
|
|
- } else {
|
|
|
|
- $this->headers[$header] = $content;
|
|
|
|
}
|
|
}
|
|
|
|
+ $this->headers = array();
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * Adds the headers to the response once it's created
|
|
|
|
|
|
+ * {@inheritDoc}
|
|
*/
|
|
*/
|
|
- public function onCoreResponse(FilterResponseEvent $event)
|
|
|
|
|
|
+ protected function sendHeader($header, $content)
|
|
{
|
|
{
|
|
- $this->response = $event->getResponse();
|
|
|
|
- foreach ($this->headers as $header => $content) {
|
|
|
|
|
|
+ if ($this->response) {
|
|
$this->response->headers->set($header, $content);
|
|
$this->response->headers->set($header, $content);
|
|
|
|
+ } else {
|
|
|
|
+ $this->headers[$header] = $content;
|
|
}
|
|
}
|
|
- $this->headers = array();
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|