Error 500 Internal Server Error

GET https://svnk.hu/contact

Exceptions

Key "name" does not exist as the sequence/mapping is empty in contact/index.html.twig at line 19.

Exception

Twig\Error\ RuntimeError

Show exception properties
Twig\Error\RuntimeError {#1204
  -lineno: 19
  -rawMessage: "Key "name" does not exist as the sequence/mapping is empty."
  -source: Twig\Source {#1183
    -code: """
      {% extends 'base.html.twig' %}\r\n
      \r\n
      {% block title %}{{ 'Contact Us'|trans }}{% endblock %}\r\n
      \r\n
      {% block body %}\r\n
      <div class="container-fluid px-3 px-md-4">\r\n
          <div class="row justify-content-center">\r\n
              <div class="col-12 col-sm-11 col-md-9 col-lg-7 col-xl-5">\r\n
                  <div class="card shadow-lg mt-4 mb-5">\r\n
                      <div class="card-header bg-primary text-white py-3 py-md-4">\r\n
                          <h2 class="card-title mb-0 fs-xs-4 fs-sm-3 fs-md-2">{{ 'Contact Us'|trans }}</h2>\r\n
                      </div>\r\n
                      <div class="card-body p-3 p-md-4">\r\n
                      <p class="mb-3 mb-md-4">{{ 'If you have any questions, feedback, or need assistance, please feel free to contact us using the form below.'|trans }}</p>\r\n
                      \r\n
                      <form method="post" action="{{ path('app_contact') }}">\r\n
                          <div class="mb-3">\r\n
                              <label for="name" class="form-label">{{ 'Name'|trans }}</label>\r\n
                              <input type="text" class="form-control {% if errors.name %}is-invalid{% endif %}" id="name" name="name" value="{{ formData.name }}" required>\r\n
                              {% if errors.name %}\r\n
                                  <div class="invalid-feedback">{{ errors.name }}</div>\r\n
                              {% endif %}\r\n
                          </div>\r\n
                          \r\n
                          <div class="mb-3">\r\n
                              <label for="email" class="form-label">{{ 'Email'|trans }}</label>\r\n
                              <input type="email" class="form-control {% if errors.email %}is-invalid{% endif %}" id="email" name="email" value="{{ formData.email }}" required>\r\n
                              {% if errors.email %}\r\n
                                  <div class="invalid-feedback">{{ errors.email }}</div>\r\n
                              {% endif %}\r\n
                          </div>\r\n
                          \r\n
                          <div class="mb-3">\r\n
                              <label for="subject" class="form-label">{{ 'Subject'|trans }}</label>\r\n
                              <input type="text" class="form-control {% if errors.subject %}is-invalid{% endif %}" id="subject" name="subject" value="{{ formData.subject }}" required>\r\n
                              {% if errors.subject %}\r\n
                                  <div class="invalid-feedback">{{ errors.subject }}</div>\r\n
                              {% endif %}\r\n
                          </div>\r\n
                          \r\n
                          <div class="mb-3">\r\n
                              <label for="message" class="form-label">{{ 'Message'|trans }}</label>\r\n
                              <textarea class="form-control {% if errors.message %}is-invalid{% endif %}" id="message" name="message" rows="5" required>{{ formData.message }}</textarea>\r\n
                              {% if errors.message %}\r\n
                                  <div class="invalid-feedback">{{ errors.message }}</div>\r\n
                              {% endif %}\r\n
                          </div>\r\n
                          \r\n
                          <div class="d-grid">\r\n
                              <button type="submit" class="btn btn-primary btn-lg">{{ 'Send Message'|trans }}</button>\r\n
                          </div>\r\n
                      </form>\r\n
                  </div>\r\n
              </div>\r\n
          </div>\r\n
      </div>\r\n
      {% endblock %}
      """
    -name: "contact/index.html.twig"
    -path: "/var/www/sites/svnk.hu/wwwroot/templates/contact/index.html.twig"
  }
  -phpFile: "/var/www/sites/svnk.hu/wwwroot/vendor/twig/twig/src/Extension/CoreExtension.php"
  -phpLine: 1741
}
  1. <p class="mb-3 mb-md-4">{{ 'If you have any questions, feedback, or need assistance, please feel free to contact us using the form below.'|trans }}</p>
  2. <form method="post" action="{{ path('app_contact') }}">
  3. <div class="mb-3">
  4. <label for="name" class="form-label">{{ 'Name'|trans }}</label>
  5. <input type="text" class="form-control {% if errors.name %}is-invalid{% endif %}" id="name" name="name" value="{{ formData.name }}" required>
  6. {% if errors.name %}
  7. <div class="invalid-feedback">{{ errors.name }}</div>
  8. {% endif %}
  9. </div>
  1. // line 18
  2. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape($this->extensions['Symfony\Bridge\Twig\Extension\TranslationExtension']->trans("Name"), "html", null, true);
  3. yield "</label>
  4. <input type=\"text\" class=\"form-control ";
  5. // line 19
  6. if ((($tmp = CoreExtension::getAttribute($this->env, $this->source, (isset($context["errors"]) || array_key_exists("errors", $context) ? $context["errors"] : (function () { throw new RuntimeError('Variable "errors" does not exist.', 19, $this->source); })()), "name", [], "any", false, false, false, 19)) && $tmp instanceof Markup ? (string) $tmp : $tmp)) {
  7. yield "is-invalid";
  8. }
  9. yield "\" id=\"name\" name=\"name\" value=\"";
  10. yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(CoreExtension::getAttribute($this->env, $this->source, (isset($context["formData"]) || array_key_exists("formData", $context) ? $context["formData"] : (function () { throw new RuntimeError('Variable "formData" does not exist.', 19, $this->source); })()), "name", [], "any", false, false, false, 19), "html", null, true);
  11. yield "\" required>
in vendor/twig/twig/src/Template.php -> block_body (line 446)
  1. throw new \LogicException('A block must be a method on a \Twig\Template instance.');
  2. }
  3. if (null !== $template) {
  4. try {
  5. yield from $template->$block($context, $blocks);
  6. } catch (Error $e) {
  7. if (!$e->getSourceContext()) {
  8. $e->setSourceContext($template->getSourceContext());
  9. }
  1. yield from $this->load("partials/flash_messages.html.twig", 84)->unwrap()->yield($context);
  2. // line 85
  3. yield "
  4. ";
  5. // line 86
  6. yield from $this->unwrap()->yieldBlock('body', $context, $blocks);
  7. // line 87
  8. yield " </div>
  9. </main>
  10. <footer class=\"footer mt-auto py-4 bg-light\" role=\"contentinfo\">
in vendor/twig/twig/src/Template.php -> doDisplay (line 402)
  1. {
  2. $context += $this->env->getGlobals();
  3. $blocks = array_merge($this->blocks, $blocks);
  4. try {
  5. yield from $this->doDisplay($context, $blocks);
  6. } catch (Error $e) {
  7. if (!$e->getSourceContext()) {
  8. $e->setSourceContext($this->getSourceContext());
  9. }
  1. $__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  2. $__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "contact/index.html.twig"));
  3. $this->parent = $this->load("base.html.twig", 1);
  4. yield from $this->parent->unwrap()->yield($context, array_merge($this->blocks, $blocks));
  5. $__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
  6. $__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
in vendor/twig/twig/src/Template.php -> doDisplay (line 402)
  1. {
  2. $context += $this->env->getGlobals();
  3. $blocks = array_merge($this->blocks, $blocks);
  4. try {
  5. yield from $this->doDisplay($context, $blocks);
  6. } catch (Error $e) {
  7. if (!$e->getSourceContext()) {
  8. $e->setSourceContext($this->getSourceContext());
  9. }
  1. return $this->blocks;
  2. }
  3. public function display(array $context, array $blocks = []): void
  4. {
  5. foreach ($this->yield($context, $blocks) as $data) {
  6. echo $data;
  7. }
  8. }
  9. public function render(array $context): string
in vendor/twig/twig/src/Template.php -> display (line 373)
  1. ob_start();
  2. } else {
  3. ob_start(function () { return ''; });
  4. }
  5. try {
  6. $this->display($context);
  7. } catch (\Throwable $e) {
  8. while (ob_get_level() > $level) {
  9. ob_end_clean();
  10. }
  1. yield from $this->template->yieldBlock($name, $context);
  2. }
  3. public function render(array $context = []): string
  4. {
  5. return $this->template->render($context);
  6. }
  7. /**
  8. * @return void
  9. */
  1. * @throws SyntaxError When an error occurred during compilation
  2. * @throws RuntimeError When an error occurred during rendering
  3. */
  4. public function render($name, array $context = []): string
  5. {
  6. return $this->load($name)->render($context);
  7. }
  8. /**
  9. * Displays a template.
  10. *
  1. if (null !== $block) {
  2. return $this->container->get('twig')->load($view)->renderBlock($block, $parameters);
  3. }
  4. return $this->container->get('twig')->render($view, $parameters);
  5. }
  6. private function doRender(string $view, ?string $block, array $parameters, ?Response $response, string $method): Response
  7. {
  8. $content = $this->doRenderView($view, $block, $parameters, $method);
  1. return $this->container->get('twig')->render($view, $parameters);
  2. }
  3. private function doRender(string $view, ?string $block, array $parameters, ?Response $response, string $method): Response
  4. {
  5. $content = $this->doRenderView($view, $block, $parameters, $method);
  6. $response ??= new Response();
  7. if (200 === $response->getStatusCode()) {
  8. foreach ($parameters as $v) {
  9. if ($v instanceof FormInterface && $v->isSubmitted() && !$v->isValid()) {
  1. * If an invalid form is found in the list of parameters, a 422 status code is returned.
  2. * Forms found in parameters are auto-cast to form views.
  3. */
  4. protected function render(string $view, array $parameters = [], ?Response $response = null): Response
  5. {
  6. return $this->doRender($view, null, $parameters, $response, __FUNCTION__);
  7. }
  8. /**
  9. * Renders a block in a view.
  10. *
AbstractController->render() in src/Controller/ContactController.php (line 75)
  1. 'formData' => $formData,
  2. 'errors' => $errors,
  3. ]);
  4. }
  5. return $this->render('contact/index.html.twig', [
  6. 'formData' => $formData,
  7. 'errors' => [],
  8. ]);
  9. }
  10. }
  1. $this->dispatcher->dispatch($event, KernelEvents::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, $event);
  9. $this->dispatcher->dispatch($event, KernelEvents::VIEW);
  1. $request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
  2. $this->requestStack->push($request);
  3. $response = null;
  4. try {
  5. return $response = $this->handleRaw($request, $type);
  6. } catch (\Throwable $e) {
  7. if ($e instanceof \Error && !$this->handleAllThrowables) {
  8. throw $e;
  9. }
  1. if (!$this->handlingHttpCache) {
  2. $this->resetServices = true;
  3. }
  4. try {
  5. return $this->getHttpKernel()->handle($request, $type, $catch);
  6. } finally {
  7. --$this->requestStackSize;
  8. }
  9. }
  1. ) {
  2. }
  3. public function run(): int
  4. {
  5. $response = $this->kernel->handle($this->request);
  6. if (Kernel::VERSION_ID >= 60400) {
  7. $response->send(false);
  8. if (\function_exists('fastcgi_finish_request') && !$this->debug) {
in vendor/autoload_runtime.php -> run (line 32)
  1. $app = $app(...$args);
  2. exit(
  3. $runtime
  4. ->getRunner($app)
  5. ->run()
  6. );
require_once('/var/www/sites/svnk.hu/wwwroot/vendor/autoload_runtime.php') in public/index.php (line 5)
  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. };

Logs

Level Channel Message
INFO 14:22:22 request Matched route "_profiler".
{
    "route": "_profiler",
    "route_parameters": {
        "_route": "_profiler",
        "_controller": "web_profiler.controller.profiler::panelAction",
        "token": "80ed06"
    },
    "request_uri": "https://svnk.hu/_profiler/80ed06",
    "method": "GET"
}

Stack Trace

RuntimeError
Twig\Error\RuntimeError:
Key "name" does not exist as the sequence/mapping is empty in "contact/index.html.twig" at line 19.

  at templates/contact/index.html.twig:19
  at Twig\Extension\CoreExtension::getAttribute()
     (var/cache/dev/twig/bb/bbe2c44fe7dac0fe510216091a032fec.php:127)
  at __TwigTemplate_1ca2bc7fd6020106c33e20281d0eb02d->block_body()
     (vendor/twig/twig/src/Template.php:446)
  at Twig\Template->yieldBlock()
     (var/cache/dev/twig/6f/6f7196f8e75eba13c61dafaf7730d760.php:223)
  at __TwigTemplate_d4d2381fdf382fb9dfadf478b3d52dd5->doDisplay()
     (vendor/twig/twig/src/Template.php:402)
  at Twig\Template->yield()
     (var/cache/dev/twig/bb/bbe2c44fe7dac0fe510216091a032fec.php:54)
  at __TwigTemplate_1ca2bc7fd6020106c33e20281d0eb02d->doDisplay()
     (vendor/twig/twig/src/Template.php:402)
  at Twig\Template->yield()
     (vendor/twig/twig/src/Template.php:358)
  at Twig\Template->display()
     (vendor/twig/twig/src/Template.php:373)
  at Twig\Template->render()
     (vendor/twig/twig/src/TemplateWrapper.php:51)
  at Twig\TemplateWrapper->render()
     (vendor/twig/twig/src/Environment.php:333)
  at Twig\Environment->render()
     (vendor/symfony/framework-bundle/Controller/AbstractController.php:467)
  at Symfony\Bundle\FrameworkBundle\Controller\AbstractController->doRenderView()
     (vendor/symfony/framework-bundle/Controller/AbstractController.php:472)
  at Symfony\Bundle\FrameworkBundle\Controller\AbstractController->doRender()
     (vendor/symfony/framework-bundle/Controller/AbstractController.php:284)
  at Symfony\Bundle\FrameworkBundle\Controller\AbstractController->render()
     (src/Controller/ContactController.php:75)
  at App\Controller\ContactController->contact()
     (vendor/symfony/http-kernel/HttpKernel.php:183)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw()
     (vendor/symfony/http-kernel/HttpKernel.php:76)
  at Symfony\Component\HttpKernel\HttpKernel->handle()
     (vendor/symfony/http-kernel/Kernel.php:193)
  at Symfony\Component\HttpKernel\Kernel->handle()
     (vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php:35)
  at Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner->run()
     (vendor/autoload_runtime.php:32)
  at require_once('/var/www/sites/svnk.hu/wwwroot/vendor/autoload_runtime.php')
     (public/index.php:5)