Symfony Exception

RuntimeError

HTTP 500 Internal Server Error

Impossible to access an attribute ("id") on a null variable.

Exception

Twig\Error\ RuntimeError

  1. {% set shortDesc = 'Cześć jestem '~ animal.name ~'. Mam około '~animalAge~' '~yearsMonths~'. '~shortDesc %}
  2. {% block description %}{{ shortDesc }}{% endblock %}
  3. {% block og_description %}{{ shortDesc }}{% endblock %}
  4. {% if animal.featuredImage.id is not empty %}
  5. {#    {% block og_image %}#}
  6. {#        {{ asset(animalImage(animal.featuredImage.path)) | imagine_filter('animal_og_image') }}#}
  7. {#    {% endblock %}#}
  8. {% endif %}
  1.         // line 56
  2.         $context["fullDesc"] = (isset($context["shortDesc"]) || array_key_exists("shortDesc"$context) ? $context["shortDesc"] : (function () { throw new RuntimeError('Variable "shortDesc" does not exist.'56$this->source); })());
  3.         // line 57
  4.         $context["shortDesc"] = ((((((("Cześć jestem " twig_get_attribute($this->env$this->source, (isset($context["animal"]) || array_key_exists("animal"$context) ? $context["animal"] : (function () { throw new RuntimeError('Variable "animal" does not exist.'57$this->source); })()), "name", [], "any"falsefalsefalse57)) . ". Mam około ") . (isset($context["animalAge"]) || array_key_exists("animalAge"$context) ? $context["animalAge"] : (function () { throw new RuntimeError('Variable "animalAge" does not exist.'57$this->source); })())) . " ") . (isset($context["yearsMonths"]) || array_key_exists("yearsMonths"$context) ? $context["yearsMonths"] : (function () { throw new RuntimeError('Variable "yearsMonths" does not exist.'57$this->source); })())) . ". ") . (isset($context["shortDesc"]) || array_key_exists("shortDesc"$context) ? $context["shortDesc"] : (function () { throw new RuntimeError('Variable "shortDesc" does not exist.'57$this->source); })()));
  5.         // line 62
  6.         if ( !twig_test_empty(twig_get_attribute($this->env$this->sourcetwig_get_attribute($this->env$this->source, (isset($context["animal"]) || array_key_exists("animal"$context) ? $context["animal"] : (function () { throw new RuntimeError('Variable "animal" does not exist.'62$this->source); })()), "featuredImage", [], "any"falsefalsefalse62), "id", [], "any"falsefalsefalse62))) {
  7.         }
  8.         // line 1
  9.         $this->parent $this->loadTemplate("layout/base.html.twig""front/animal/single.html.twig"1);
  10.         $this->parent->display($contextarray_merge($this->blocks$blocks));
  11.         
in vendor/twig/twig/src/Template.php -> doDisplay (line 394)
  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 367)
  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 379)
  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.     public function render(array $context = []): string
  2.     {
  3.         // using func_get_args() allows to not expose the blocks argument
  4.         // as it should only be used by internal code
  5.         return $this->template->render($context\func_get_args()[1] ?? []);
  6.     }
  7.     public function display(array $context = [])
  8.     {
  9.         // using func_get_args() allows to not expose the blocks argument
  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 ($v instanceof FormInterface) {
  2.                 $parameters[$k] = $v->createView();
  3.             }
  4.         }
  5.         return $this->container->get('twig')->render($view$parameters);
  6.     }
  7.     /**
  8.      * Renders a view.
  9.      *
  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.         $content $this->renderView($view$parameters);
  7.         $response ??= new Response();
  8.         if (200 === $response->getStatusCode()) {
  9.             foreach ($parameters as $v) {
  10.                 if ($v instanceof FormInterface && $v->isSubmitted() && !$v->isValid()) {
AbstractController->render() in src/Controller/Front/AnimalController.php (line 251)
  1.                 'front/animal/single.html.twig',
  2.             [
  3.                 'animal' => $animal,
  4. //                'poll' => $poll,
  5.                 'notes' => $notes,
  6.                 'similarAnimals' => $similarAnimals
  7.             ]
  8.         );
  9.     }
in vendor/symfony/http-kernel/HttpKernel.php -> singleAction (line 163)
  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$event);
  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 (\Throwable $e) {
  7.             if ($e instanceof \Error && !$this->handleAllThrowables) {
  8.                 throw $e;
  9.             }
  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 29)
  1. $app $app(...$args);
  2. exit(
  3.     $runtime
  4.         ->getRunner($app)
  5.         ->run()
  6. );
require_once('/home/adopt/web/adopciaki.pl/public_html/vendor/autoload_runtime.php') in public/index.php (line 6)
  1. <?php
  2. use App\Kernel;
  3. use Symfony\Component\HttpFoundation\Request;
  4. require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
  5. return function (array $context) {
  6.     $request Request::createFromGlobals();
  7.     if($request->getClientIp() == "95.217.17.2") {

Logs

No log messages

Stack Trace

RuntimeError
Twig\Error\RuntimeError:
Impossible to access an attribute ("id") on a null variable.

  at templates/front/animal/single.html.twig:62
  at twig_get_attribute()
     (var/cache/dev/twig/13/139e5aca06ce7d8199d04f02c69a2a20.php:127)
  at __TwigTemplate_4f65eec05383462cda21775d2c12cbf9->doDisplay()
     (vendor/twig/twig/src/Template.php:394)
  at Twig\Template->displayWithErrorHandling()
     (vendor/twig/twig/src/Template.php:367)
  at Twig\Template->display()
     (vendor/twig/twig/src/Template.php:379)
  at Twig\Template->render()
     (vendor/twig/twig/src/TemplateWrapper.php:40)
  at Twig\TemplateWrapper->render()
     (vendor/twig/twig/src/Environment.php:280)
  at Twig\Environment->render()
     (vendor/symfony/framework-bundle/Controller/AbstractController.php:242)
  at Symfony\Bundle\FrameworkBundle\Controller\AbstractController->renderView()
     (vendor/symfony/framework-bundle/Controller/AbstractController.php:253)
  at Symfony\Bundle\FrameworkBundle\Controller\AbstractController->render()
     (src/Controller/Front/AnimalController.php:251)
  at App\Controller\Front\AnimalController->singleAction()
     (vendor/symfony/http-kernel/HttpKernel.php:163)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw()
     (vendor/symfony/http-kernel/HttpKernel.php:74)
  at Symfony\Component\HttpKernel\HttpKernel->handle()
     (vendor/symfony/http-kernel/Kernel.php:184)
  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:29)
  at require_once('/home/adopt/web/adopciaki.pl/public_html/vendor/autoload_runtime.php')
     (public/index.php:6)