Connectez-vous!

Loading…
Loading the web debug toolbar…
Attempt #
Failed to start the session because headers have already been sent by "/var/www/vhosts/careconcept-n2a.myn2a.online/httpdocs/vendor/symfony/http-foundation/Response.php" at line 380. (500 Internal Server Error)

Symfony Exception

RuntimeException

HTTP 500 Internal Server Error

Failed to start the session because headers have already been sent by "/var/www/vhosts/careconcept-n2a.myn2a.online/httpdocs/vendor/symfony/http-foundation/Response.php" at line 380.

Exception

RuntimeException

  1. if (\PHP_SESSION_ACTIVE === session_status()) {
  2. throw new \RuntimeException('Failed to start the session: already started by PHP.');
  3. }
  4. if (filter_var(\ini_get('session.use_cookies'), \FILTER_VALIDATE_BOOL) && headers_sent($file, $line)) {
  5. throw new \RuntimeException(\sprintf('Failed to start the session because headers have already been sent by "%s" at line %d.', $file, $line));
  6. }
  7. $sessionId = $_COOKIE[session_name()] ?? null;
  8. /*
  9. * Explanation of the session ID regular expression: `/^[a-zA-Z0-9,-]{22,250}$/`.
  1. }
  2. if (!$this->started && $this->saveHandler->isActive()) {
  3. $this->loadSession();
  4. } elseif (!$this->started) {
  5. $this->start();
  6. }
  7. return $this->bags[$name];
  8. }
  1. $this->storage->registerBag(new SessionBagProxy($bag, $this->data, $this->usageIndex, $this->usageReporter));
  2. }
  3. public function getBag(string $name): SessionBagInterface
  4. {
  5. $bag = $this->storage->getBag($name);
  6. return method_exists($bag, 'getBag') ? $bag->getBag() : $bag;
  7. }
  8. /**
  1. *
  2. * Note that this method was added to help with IDE autocompletion.
  3. */
  4. private function getAttributeBag(): AttributeBagInterface
  5. {
  6. return $this->getBag($this->attributeName);
  7. }
  8. }
  1. return $this->getAttributeBag()->has($name);
  2. }
  3. public function get(string $name, mixed $default = null): mixed
  4. {
  5. return $this->getAttributeBag()->get($name, $default);
  6. }
  7. public function set(string $name, mixed $value): void
  8. {
  9. $this->getAttributeBag()->set($name, $value);
  1. public function getPayload(): array
  2. {
  3. $session = $this->requestStack->getSession();
  4. $data = $session->get('platform_login_content', []);
  5. // Récupérer les détails de la collaboration active depuis la session (qui contient api_services)
  6. $activeCollabDetails = $session->get('active_collaboration')['details'] ?? null;
  7. return [
  1. protected function initializeCollaborationContext(Request $request): array|RedirectResponse
  2. {
  3. $this->session = $request->getSession();
  4. // ⚠️ $this->userSessionService DOIT être initialisé dans le contrôleur
  5. $payload = $this->userSessionService->getPayload();
  6. if (!$payload) {
  7. return new RedirectResponse('/login');
  8. }
ExceptionListener->initializeCollaborationContext() in /var/www/vhosts/careconcept-n2a.myn2a.online/httpdocs/src/EventListener/ExceptionListener.php (line 45)
  1. $request = $this->requestStack->getCurrentRequest();
  2. $context = [];
  3. if ($request) {
  4. $ctx = $this->initializeCollaborationContext($request);
  5. if ($ctx instanceof RedirectResponse) {
  6. $event->setResponse($ctx);
  7. return;
  8. }
  9. $context = $ctx;
  1. $this->priority ??= $dispatcher->getListenerPriority($eventName, $this->listener);
  2. $e = $this->stopwatch->start($this->name, 'event_listener');
  3. try {
  4. ($this->optimizedListener ?? $this->listener)($event, $eventName, $dispatcher);
  5. } finally {
  6. if ($e->isStarted()) {
  7. $e->stop();
  8. }
  9. }
  1. foreach ($listeners as $listener) {
  2. if ($stoppable && $event->isPropagationStopped()) {
  3. break;
  4. }
  5. $listener($event, $eventName, $this);
  6. }
  7. }
  8. /**
  9. * Sorts the internal list of listeners for the given event by priority.
  1. } else {
  2. $listeners = $this->getListeners($eventName);
  3. }
  4. if ($listeners) {
  5. $this->callListeners($listeners, $eventName, $event);
  6. }
  7. return $event;
  8. }
  1. try {
  2. $this->beforeDispatch($eventName, $event);
  3. try {
  4. $e = $this->stopwatch->start($eventName, 'section');
  5. try {
  6. $this->dispatcher->dispatch($event, $eventName);
  7. } finally {
  8. if ($e->isStarted()) {
  9. $e->stop();
  10. }
  11. }
  1. * Handles a throwable by trying to convert it to a Response.
  2. */
  3. private function handleThrowable(\Throwable $e, Request $request, int $type): Response
  4. {
  5. $event = new ExceptionEvent($this, $request, $type, $e, isKernelTerminating: $this->terminating);
  6. $this->dispatcher->dispatch($event, KernelEvents::EXCEPTION);
  7. // a listener might have replaced the exception
  8. $e = $event->getThrowable();
  9. if (!$event->hasResponse()) {
  1. if ($pop = $request !== $this->requestStack->getMainRequest()) {
  2. $this->requestStack->push($request);
  3. }
  4. try {
  5. $response = $this->handleThrowable($exception, $request, self::MAIN_REQUEST);
  6. } finally {
  7. if ($pop) {
  8. $this->requestStack->pop();
  9. }
  10. }
  1. if ($hasRun) {
  2. throw $e;
  3. }
  4. $hasRun = true;
  5. $kernel->terminateWithException($e, $request);
  6. };
  7. }
  8. } elseif ($event instanceof ConsoleEvent && $app = $event->getCommand()->getApplication()) {
  9. $output = $event->getOutput();
  10. if ($output instanceof ConsoleOutputInterface) {
in /var/www/vhosts/careconcept-n2a.myn2a.online/httpdocs/vendor/symfony/error-handler/ErrorHandler.php :: {closure:Symfony\Component\HttpKernel\EventListener\DebugHandlersListener::configure():78} (line 538)
  1. $this->exceptionHandler = null;
  2. }
  3. try {
  4. if (null !== $exceptionHandler) {
  5. $exceptionHandler($exception);
  6. return;
  7. }
  8. $handlerException ??= $exception;
  9. } catch (\Throwable $handlerException) {
ErrorHandler->handleException()

Stack Trace

RuntimeException
RuntimeException:
Failed to start the session because headers have already been sent by "/var/www/vhosts/careconcept-n2a.myn2a.online/httpdocs/vendor/symfony/http-foundation/Response.php" at line 380.

  at /var/www/vhosts/careconcept-n2a.myn2a.online/httpdocs/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php:116
  at Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->start()
     (/var/www/vhosts/careconcept-n2a.myn2a.online/httpdocs/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php:282)
  at Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->getBag()
     (/var/www/vhosts/careconcept-n2a.myn2a.online/httpdocs/vendor/symfony/http-foundation/Session/Session.php:201)
  at Symfony\Component\HttpFoundation\Session\Session->getBag()
     (/var/www/vhosts/careconcept-n2a.myn2a.online/httpdocs/vendor/symfony/http-foundation/Session/Session.php:221)
  at Symfony\Component\HttpFoundation\Session\Session->getAttributeBag()
     (/var/www/vhosts/careconcept-n2a.myn2a.online/httpdocs/vendor/symfony/http-foundation/Session/Session.php:69)
  at Symfony\Component\HttpFoundation\Session\Session->get()
     (/var/www/vhosts/careconcept-n2a.myn2a.online/httpdocs/src/Service/UserSessionService.php:24)
  at App\Service\UserSessionService->getPayload()
     (/var/www/vhosts/careconcept-n2a.myn2a.online/httpdocs/src/Controller/Traits/CollaborationTrait.php:25)
  at App\EventListener\ExceptionListener->initializeCollaborationContext()
     (/var/www/vhosts/careconcept-n2a.myn2a.online/httpdocs/src/EventListener/ExceptionListener.php:45)
  at App\EventListener\ExceptionListener->__invoke()
     (/var/www/vhosts/careconcept-n2a.myn2a.online/httpdocs/vendor/symfony/event-dispatcher/Debug/WrappedListener.php:115)
  at Symfony\Component\EventDispatcher\Debug\WrappedListener->__invoke()
     (/var/www/vhosts/careconcept-n2a.myn2a.online/httpdocs/vendor/symfony/event-dispatcher/EventDispatcher.php:206)
  at Symfony\Component\EventDispatcher\EventDispatcher->callListeners()
     (/var/www/vhosts/careconcept-n2a.myn2a.online/httpdocs/vendor/symfony/event-dispatcher/EventDispatcher.php:56)
  at Symfony\Component\EventDispatcher\EventDispatcher->dispatch()
     (/var/www/vhosts/careconcept-n2a.myn2a.online/httpdocs/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:122)
  at Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->dispatch()
     (/var/www/vhosts/careconcept-n2a.myn2a.online/httpdocs/vendor/symfony/http-kernel/HttpKernel.php:241)
  at Symfony\Component\HttpKernel\HttpKernel->handleThrowable()
     (/var/www/vhosts/careconcept-n2a.myn2a.online/httpdocs/vendor/symfony/http-kernel/HttpKernel.php:134)
  at Symfony\Component\HttpKernel\HttpKernel->terminateWithException()
     (/var/www/vhosts/careconcept-n2a.myn2a.online/httpdocs/vendor/symfony/http-kernel/EventListener/DebugHandlersListener.php:84)
  at Symfony\Component\HttpKernel\EventListener\DebugHandlersListener::{closure:Symfony\Component\HttpKernel\EventListener\DebugHandlersListener::configure():78}()
     (/var/www/vhosts/careconcept-n2a.myn2a.online/httpdocs/vendor/symfony/error-handler/ErrorHandler.php:538)
  at Symfony\Component\ErrorHandler\ErrorHandler->handleException()