Symfony Exception

RuntimeError

HTTP 500 Internal Server Error

Key "0" does not exist as the array is empty.

Exception

Twig\Error\ RuntimeError

  1.         if ($this->extensions['SunCat\MobileDetectBundle\Twig\Extension\MobileDetectExtension']->isMobile()) {
  2.             echo "background-size: cover;";
  3.         }
  4.         // line 22
  5.         echo "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbackground-image:url('";
  6.         if ((twig_get_attribute($this->env$this->source, (isset($context["courses"]) || array_key_exists("courses"$context) ? $context["courses"] : (function () { throw new RuntimeError('Variable "courses" does not exist.'22$this->source); })()), 0, [], "array"falsefalsefalse22) && twig_get_attribute($this->env$this->sourcetwig_get_attribute($this->env$this->source, (isset($context["courses"]) || array_key_exists("courses"$context) ? $context["courses"] : (function () { throw new RuntimeError('Variable "courses" does not exist.'22$this->source); })()), 0, [], "array"falsefalsefalse22), "headerImage", [], "any"falsefalsefalse22))) {
  7.             echo twig_escape_filter($this->env, (isset($context["site_url"]) || array_key_exists("site_url"$context) ? $context["site_url"] : (function () { throw new RuntimeError('Variable "site_url" does not exist.'22$this->source); })()), "html"nulltrue);
  8.             echo "/";
  9.             echo twig_escape_filter($this->env, (isset($context["path_upload_img"]) || array_key_exists("path_upload_img"$context) ? $context["path_upload_img"] : (function () { throw new RuntimeError('Variable "path_upload_img" does not exist.'22$this->source); })()), "html"nulltrue);
  10.             echo "/";
  11.             echo twig_escape_filter($this->envtwig_get_attribute($this->env$this->sourcetwig_get_attribute($this->env$this->source, (isset($context["courses"]) || array_key_exists("courses"$context) ? $context["courses"] : (function () { throw new RuntimeError('Variable "courses" does not exist.'22$this->source); })()), 0, [], "array"falsefalsefalse22), "headerImage", [], "any"falsefalsefalse22), "html"nulltrue);
in vendor/twig/twig/src/Template.php -> block_body (line 182)
  1.             throw new \LogicException('A block must be a method on a \Twig\Template instance.');
  2.         }
  3.         if (null !== $template) {
  4.             try {
  5.                 $template->$block($context$blocks);
  6.             } catch (Error $e) {
  7.                 if (!$e->getSourceContext()) {
  8.                     $e->setSourceContext($template->getSourceContext());
  9.                 }
  1.         $this->loadTemplate("Front/base/menu.html.twig""Front/base.html.twig"219)->display($context);
  2.         // line 220
  3.         echo "  \t
  4.     ";
  5.         // line 221
  6.         $this->displayBlock('body'$context$blocks);
  7.         // line 222
  8.         echo "
  9. \t\t";
  10.         // line 223
  11.         $this->displayBlock('rules'$context$blocks);
in vendor/twig/twig/src/Template.php -> doDisplay (line 405)
  1.     }
  2.     protected function displayWithErrorHandling(array $context, array $blocks = [])
  3.     {
  4.         try {
  5.             $this->doDisplay($context$blocks);
  6.         } catch (Error $e) {
  7.             if (!$e->getSourceContext()) {
  8.                 $e->setSourceContext($this->getSourceContext());
  9.             }
in vendor/twig/twig/src/Template.php -> displayWithErrorHandling (line 378)
  1.         return $this->blocks;
  2.     }
  3.     public function display(array $context, array $blocks = [])
  4.     {
  5.         $this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks$blocks));
  6.     }
  7.     public function render(array $context)
  8.     {
  9.         $level ob_get_level();
  1.         $macros $this->macros;
  2.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  3.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template""Front/tours.html.twig"));
  4.         $this->parent $this->loadTemplate("Front/base.html.twig""Front/tours.html.twig"1);
  5.         $this->parent->display($contextarray_merge($this->blocks$blocks));
  6.         
  7.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof);
  8.     }
in vendor/twig/twig/src/Template.php -> doDisplay (line 405)
  1.     }
  2.     protected function displayWithErrorHandling(array $context, array $blocks = [])
  3.     {
  4.         try {
  5.             $this->doDisplay($context$blocks);
  6.         } catch (Error $e) {
  7.             if (!$e->getSourceContext()) {
  8.                 $e->setSourceContext($this->getSourceContext());
  9.             }
in vendor/twig/twig/src/Template.php -> displayWithErrorHandling (line 378)
  1.         return $this->blocks;
  2.     }
  3.     public function display(array $context, array $blocks = [])
  4.     {
  5.         $this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks$blocks));
  6.     }
  7.     public function render(array $context)
  8.     {
  9.         $level ob_get_level();
in vendor/twig/twig/src/Template.php -> display (line 390)
  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.      */
  2.     public function render(array $context = []): string
  3.     {
  4.         // using func_get_args() allows to not expose the blocks argument
  5.         // as it should only be used by internal code
  6.         return $this->template->render($context, \func_get_args()[1] ?? []);
  7.     }
  8.     /**
  9.      * Displays the template.
  10.      *
  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 = [])
  5.     {
  6.         return $this->load($name)->render($context);
  7.     }
  8.     /**
  9.      * Displays a template.
  10.      *
  1.         if ($this->container->has('templating') && $this->container->get('templating')->supports($view)) {
  2.             @trigger_error('Using the "templating" service is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.', \E_USER_DEPRECATED);
  3.             $content $this->container->get('templating')->render($view$parameters);
  4.         } elseif ($this->container->has('twig')) {
  5.             $content $this->container->get('twig')->render($view$parameters);
  6.         } else {
  7.             throw new \LogicException('You can not use the "render" method if the Templating Component or the Twig Bundle are not available. Try running "composer require symfony/twig-bundle".');
  8.         }
  9.         if (null === $response) {
AbstractController->render() in src/Controller/FrontController.php (line 726)
  1.                             //'jsonCourses'=>$jsonCourses,
  2.                             'imageLogoHome' => $settings->getImageLogoHome(),
  3.                             'moodsForSearch'=>$moodsForSearch,
  4.                             'reviews' => $reviews,
  5.                             'baseParams' => $baseService->getBaseParams(),
  6.                             'site_url' => $this->getParameter('site_url')
  7.                     ));
  8.     }
  9.     /**
in vendor/symfony/http-kernel/HttpKernel.php -> toursAction (line 169)
  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.     {
  2.         $request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
  3.         $this->requestStack->push($request);
  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.     }
Kernel->handle() in public/index.php (line 25)
  1.     Request::setTrustedHosts([$trustedHosts]);
  2. }
  3. $kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
  4. $request Request::createFromGlobals();
  5. $response $kernel->handle($request);
  6. $response->send();
  7. $kernel->terminate($request$response);

Logs

No log messages

Stack Trace

RuntimeError

Twig\Error\RuntimeError:
Key "0" does not exist as the array is empty.

  at /var/www/PHP/repare/intripid-web/templates/Front/tours.html.twig:22
  at twig_get_attribute()
     (var/cache/prod/twig/86/860e1485e55b73c01b36340ca0ed8c82979fc3768e64f9f48a4d97af99770dc7.php:138)
  at __TwigTemplate_bae317abab04f8cd0c2d0b836b76fddde1747803d5cb4d2f80a7d9aa1b038903->block_body()
     (vendor/twig/twig/src/Template.php:182)
  at Twig\Template->displayBlock()
     (var/cache/prod/twig/d8/d8961b82b2bcea31f9242ebfc57c8d7bb44139534541a5ad74f94d0f8b5ffb24.php:236)
  at __TwigTemplate_44b1368f443753fa4c81ddd65cbaebdaf1e04b5848f2ce3140f671174a981f84->doDisplay()
     (vendor/twig/twig/src/Template.php:405)
  at Twig\Template->displayWithErrorHandling()
     (vendor/twig/twig/src/Template.php:378)
  at Twig\Template->display()
     (var/cache/prod/twig/86/860e1485e55b73c01b36340ca0ed8c82979fc3768e64f9f48a4d97af99770dc7.php:49)
  at __TwigTemplate_bae317abab04f8cd0c2d0b836b76fddde1747803d5cb4d2f80a7d9aa1b038903->doDisplay()
     (vendor/twig/twig/src/Template.php:405)
  at Twig\Template->displayWithErrorHandling()
     (vendor/twig/twig/src/Template.php:378)
  at Twig\Template->display()
     (vendor/twig/twig/src/Template.php:390)
  at Twig\Template->render()
     (vendor/twig/twig/src/TemplateWrapper.php:45)
  at Twig\TemplateWrapper->render()
     (vendor/twig/twig/src/Environment.php:318)
  at Twig\Environment->render()
     (vendor/symfony/framework-bundle/Controller/ControllerTrait.php:235)
  at Symfony\Bundle\FrameworkBundle\Controller\AbstractController->render()
     (src/Controller/FrontController.php:726)
  at App\Controller\FrontController->toursAction()
     (vendor/symfony/http-kernel/HttpKernel.php:169)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw()
     (vendor/symfony/http-kernel/HttpKernel.php:81)
  at Symfony\Component\HttpKernel\HttpKernel->handle()
     (vendor/symfony/http-kernel/Kernel.php:201)
  at Symfony\Component\HttpKernel\Kernel->handle()
     (public/index.php:25)