Deprecated: Required parameter $json follows optional parameter $jsonModified in /var/www/AFD-ENTRAIN/diabetassurdevis/src/Service/Entrain/MailServiceEntrain.php on line 844
The HTTP status code "0" is not valid. (500 Internal Server Error)

Symfony Exception

InvalidArgumentException

HTTP 500 Internal Server Error

The HTTP status code "0" is not valid.

Exception

InvalidArgumentException

  1.      */
  2.     public function setStatusCode(int $codestring $text null): object
  3.     {
  4.         $this->statusCode $code;
  5.         if ($this->isInvalid()) {
  6.             throw new \InvalidArgumentException(sprintf('The HTTP status code "%s" is not valid.'$code));
  7.         }
  8.         if (null === $text) {
  9.             $this->statusText self::$statusTexts[$code] ?? 'unknown status';
in vendor/symfony/http-foundation/Response.php -> setStatusCode (line 219)
  1.      */
  2.     public function __construct(?string $content ''int $status 200, array $headers = [])
  3.     {
  4.         $this->headers = new ResponseHeaderBag($headers);
  5.         $this->setContent($content);
  6.         $this->setStatusCode($status);
  7.         $this->setProtocolVersion('1.0');
  8.     }
  9.     /**
  10.      * Factory method for chainability.
  1.      * @param array $headers An array of response headers
  2.      * @param bool  $json    If the data is already a JSON string
  3.      */
  4.     public function __construct($data nullint $status 200, array $headers = [], bool $json false)
  5.     {
  6.         parent::__construct(''$status$headers);
  7.         if ($json && !\is_string($data) && !is_numeric($data) && !\is_callable([$data'__toString'])) {
  8.             throw new \TypeError(sprintf('"%s": If $json is set to true, argument $data must be a string or object implementing __toString(), "%s" given.'__METHOD__get_debug_type($data)));
  9.         }
  1.         if ($this->container->has('serializer')) {
  2.             $json $this->container->get('serializer')->serialize($data'json'array_merge([
  3.                 'json_encode_options' => JsonResponse::DEFAULT_ENCODING_OPTIONS,
  4.             ], $context));
  5.             return new JsonResponse($json$status$headerstrue);
  6.         }
  7.         return new JsonResponse($data$status$headers);
  8.     }
AbstractController->json() in src/Controller/Entrain/SubscriptionControllerEntrain.php (line 67)
  1.             $this->entityManager->persist($contract);
  2.             $this->entityManager->flush();
  3.         } catch (Exception $e) {
  4.             return $this->json([
  5.                 'message' => $e->getMessage()
  6.             ], $e->getCode());
  7.         }
  8.         $insurer_mails = [(isset($jsonSurvey->question57)) ? $jsonSurvey->question57 null, (isset($jsonSurvey->question58)) ? $jsonSurvey->question58 null];
  9.         $statut $params->statut;
  10.         try {
  1.         $this->dispatcher->dispatch($eventKernelEvents::CONTROLLER_ARGUMENTS);
  2.         $controller $event->getController();
  3.         $arguments $event->getArguments();
  4.         // call controller
  5.         $response $controller(...$arguments);
  6.         // view
  7.         if (!$response instanceof Response) {
  8.             $event = new ViewEvent($this$request$type$response);
  9.             $this->dispatcher->dispatch($eventKernelEvents::VIEW);
  1.     public function handle(Request $requestint $type HttpKernelInterface::MAIN_REQUESTbool $catch true)
  2.     {
  3.         $request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
  4.         try {
  5.             return $this->handleRaw($request$type);
  6.         } catch (\Exception $e) {
  7.             if ($e instanceof RequestExceptionInterface) {
  8.                 $e = new BadRequestHttpException($e->getMessage(), $e);
  9.             }
  10.             if (false === $catch) {
  1.         $this->boot();
  2.         ++$this->requestStackSize;
  3.         $this->resetServices true;
  4.         try {
  5.             return $this->getHttpKernel()->handle($request$type$catch);
  6.         } finally {
  7.             --$this->requestStackSize;
  8.         }
  9.     }
  1.         $this->request $request;
  2.     }
  3.     public function run(): int
  4.     {
  5.         $response $this->kernel->handle($this->request);
  6.         $response->send();
  7.         if ($this->kernel instanceof TerminableInterface) {
  8.             $this->kernel->terminate($this->request$response);
  9.         }
in vendor/autoload_runtime.php -> run (line 35)
  1. $app $app(...$args);
  2. exit(
  3.     $runtime
  4.         ->getRunner($app)
  5.         ->run()
  6. );
require_once('/var/www/AFD-ENTRAIN/diabetassurdevis/vendor/autoload_runtime.php') in public/index.php (line 6)
  1. <?php
  2. use App\Kernel;
  3. require_once dirname(__DIR__) . '/vendor/autoload_runtime.php';
  4. return function (array $context) {
  5.     return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
  6. };

Stack Trace

InvalidArgumentException
InvalidArgumentException:
The HTTP status code "0" is not valid.

  at vendor/symfony/http-foundation/Response.php:469
  at Symfony\Component\HttpFoundation\Response->setStatusCode()
     (vendor/symfony/http-foundation/Response.php:219)
  at Symfony\Component\HttpFoundation\Response->__construct()
     (vendor/symfony/http-foundation/JsonResponse.php:44)
  at Symfony\Component\HttpFoundation\JsonResponse->__construct()
     (vendor/symfony/framework-bundle/Controller/AbstractController.php:178)
  at Symfony\Bundle\FrameworkBundle\Controller\AbstractController->json()
     (src/Controller/Entrain/SubscriptionControllerEntrain.php:67)
  at App\Controller\Entrain\SubscriptionControllerEntrain->index()
     (vendor/symfony/http-kernel/HttpKernel.php:156)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw()
     (vendor/symfony/http-kernel/HttpKernel.php:78)
  at Symfony\Component\HttpKernel\HttpKernel->handle()
     (vendor/symfony/http-kernel/Kernel.php:199)
  at Symfony\Component\HttpKernel\Kernel->handle()
     (vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php:37)
  at Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner->run()
     (vendor/autoload_runtime.php:35)
  at require_once('/var/www/AFD-ENTRAIN/diabetassurdevis/vendor/autoload_runtime.php')
     (public/index.php:6)