public function handle(EventInterface $event)
 {
     static $handling;
     if (true === $handling) {
         return false;
     }
     $handling = true;
     $exception = $event->get('exception');
     $request = $event->get('request');
     if (null !== $this->logger) {
         $this->logger->err(sprintf('%s: %s (uncaught exception)', get_class($exception), $exception->getMessage()));
     } else {
         error_log(sprintf('Uncaught PHP Exception %s: "%s" at %s line %s', get_class($exception), $exception->getMessage(), $exception->getFile(), $exception->getLine()));
     }
     $logger = null !== $this->logger ? $this->logger->getDebugLogger() : null;
     $attributes = array('_controller' => $this->controller, 'exception' => FlattenException::create($exception), 'logger' => $logger, 'format' => 0 === strncasecmp(PHP_SAPI, 'cli', 3) ? 'txt' : $request->getRequestFormat());
     $request = $request->duplicate(null, null, $attributes);
     try {
         $response = $event->getSubject()->handle($request, HttpKernelInterface::SUB_REQUEST, true);
     } catch (\Exception $e) {
         $message = sprintf('Exception thrown when handling an exception (%s: %s)', get_class($e), $e->getMessage());
         if (null !== $this->logger) {
             $this->logger->err($message);
         } else {
             error_log($message);
         }
         // re-throw the exception as this is a catch-all
         throw $exception;
     }
     $event->setProcessed();
     $handling = false;
     return $response;
 }
 /**
  * {@inheritdoc}
  */
 public function start(EventInterface $event, Request $request, AuthenticationException $authException = null)
 {
     if ($this->useForward) {
         return $event->getSubject()->handle(Request::create($this->loginPath), HttpKernelInterface::SUB_REQUEST);
     }
     return new RedirectResponse(0 !== strpos($this->loginPath, 'http') ? $request->getUriForPath($this->loginPath) : $this->loginPath, 302);
 }
 protected function addCall(EventInterface $event, $listener, $type)
 {
     $listener = $this->listenerToString($listener);
     if (null !== $this->logger) {
         $this->logger->debug(sprintf('Notified event "%s" to listener "%s" (%s)', $event->getName(), $listener, $type));
     }
     $this->called[$event->getName() . '.' . $listener] = array('event' => $event->getName(), 'caller' => null !== $event->getSubject() ? get_class($event->getSubject()) : null, 'listener' => $listener);
 }