Symfony Exception

Twig_Error_Runtime

HTTP 500 Internal Server Error

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

Exception

Twig_Error_Runtime

  1.             <h2>
  2.                 Testimonial von {{ testimonial.name }} für
  3.                 {% if testimonial.tree %}
  4.                     Baum {{ testimonial.tree.number }}
  5.                 {% elseif testimonial.rock %}
  6.                     Stein {{ testimonial.tree.number }}
  7.                 {% elseif testimonial.person %}
  8.                     {{ testimonial.person.name }}
  9.                 {% endif %}
  10.             </h2>
  11.             <p>{{ testimonial.getText(app.request.locale)|nl2br }}</p>
  1.                 ";
  2.         } elseif (twig_get_attribute($this->env$this->source,         // line 20
  3. (isset($context["testimonial"]) || array_key_exists("testimonial"$context) ? $context["testimonial"] : (function () { throw new Twig_Error_Runtime('Variable "testimonial" does not exist.'20$this->source); })()), "rock", array())) {
  4.             // line 21
  5.             echo "                    Stein ";
  6.             echo twig_escape_filter($this->envtwig_get_attribute($this->env$this->sourcetwig_get_attribute($this->env$this->source, (isset($context["testimonial"]) || array_key_exists("testimonial"$context) ? $context["testimonial"] : (function () { throw new Twig_Error_Runtime('Variable "testimonial" does not exist.'21$this->source); })()), "tree", array()), "number", array()), "html"nulltrue);
  7.             echo "
  8.                 ";
  9.         } elseif (twig_get_attribute($this->env$this->source,         // line 22
  10. (isset($context["testimonial"]) || array_key_exists("testimonial"$context) ? $context["testimonial"] : (function () { throw new Twig_Error_Runtime('Variable "testimonial" does not exist.'22$this->source); })()), "person", array())) {
  11.             // line 23
in vendor/twig/twig/lib/Twig/Template.php->block_main (line 189)
  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 (Twig_Error $e) {
  7.                 if (!$e->getSourceContext()) {
  8.                     $e->setSourceContext($template->getSourceContext());
  9.                 }
  1.             </div>
  2.         </header>
  3.         <main>
  4.             ";
  5.         // line 88
  6.         $this->displayBlock('main'$context$blocks);
  7.         // line 89
  8.         echo "        </main>
  9.         <footer>
  10.             <div class=\"columns is-gapless is-mobile\">
  11.                 <div class=\"column is-1\">
in vendor/twig/twig/lib/Twig/Template.php->doDisplay (line 390)
  1.     }
  2.     protected function displayWithErrorHandling(array $context, array $blocks = array())
  3.     {
  4.         try {
  5.             $this->doDisplay($context$blocks);
  6.         } catch (Twig_Error $e) {
  7.             if (!$e->getSourceContext()) {
  8.                 $e->setSourceContext($this->getSourceContext());
  9.             }
in vendor/twig/twig/lib/Twig/Template.php->displayWithErrorHandling (line 367)
  1.         return $this->blocks;
  2.     }
  3.     public function display(array $context, array $blocks = array())
  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.     protected function doDisplay(array $context, array $blocks = array())
  2.     {
  3.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  4.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new Twig_Profiler_Profile($this->getTemplateName(), "template""testimonial/show.html.twig"));
  5.         $this->parent->display($contextarray_merge($this->blocks$blocks));
  6.         
  7.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof);
  8.     }
in vendor/twig/twig/lib/Twig/Template.php->doDisplay (line 390)
  1.     }
  2.     protected function displayWithErrorHandling(array $context, array $blocks = array())
  3.     {
  4.         try {
  5.             $this->doDisplay($context$blocks);
  6.         } catch (Twig_Error $e) {
  7.             if (!$e->getSourceContext()) {
  8.                 $e->setSourceContext($this->getSourceContext());
  9.             }
in vendor/twig/twig/lib/Twig/Template.php->displayWithErrorHandling (line 367)
  1.         return $this->blocks;
  2.     }
  3.     public function display(array $context, array $blocks = array())
  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.     public function render(array $context)
  2.     {
  3.         $level ob_get_level();
  4.         ob_start();
  5.         try {
  6.             $this->display($context);
  7.         } catch (Throwable $e) {
  8.             while (ob_get_level() > $level) {
  9.                 ob_end_clean();
  10.             }
  1.      * @throws Twig_Error_Syntax  When an error occurred during compilation
  2.      * @throws Twig_Error_Runtime When an error occurred during rendering
  3.      */
  4.     public function render($name, array $context = array())
  5.     {
  6.         return $this->loadTemplate($name)->render($context);
  7.     }
  8.     /**
  9.      * Displays a template.
  10.      *
  1.     protected function render(string $view, array $parameters = array(), Response $response null): Response
  2.     {
  3.         if ($this->container->has('templating')) {
  4.             $content $this->container->get('templating')->render($view$parameters);
  5.         } elseif ($this->container->has('twig')) {
  6.             $content $this->container->get('twig')->render($view$parameters);
  7.         } else {
  8.             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".');
  9.         }
  10.         if (null === $response) {
AbstractController->render('testimonial/show.html.twig', array('testimonial' => object(Testimonial))) in src/Controller/TestimonialController.php (line 27)
  1.         if($testimonial == null) {
  2.             throw new HttpException(404);
  3.         }
  4.         return $this->render('testimonial/show.html.twig', ['testimonial' => $testimonial]);
  5.     }
  6. }
  1.         $this->dispatcher->dispatch(KernelEvents::CONTROLLER_ARGUMENTS$event);
  2.         $controller $event->getController();
  3.         $arguments $event->getArguments();
  4.         // call controller
  5.         $response = \call_user_func_array($controller$arguments);
  6.         // view
  7.         if (!$response instanceof Response) {
  8.             $event = new GetResponseForControllerResultEvent($this$request$type$response);
  9.             $this->dispatcher->dispatch(KernelEvents::VIEW$event);
  1.     public function handle(Request $request$type HttpKernelInterface::MASTER_REQUEST$catch true)
  2.     {
  3.         $request->headers->set('X-Php-Ob-Level'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.     }
Kernel->handle(object(Request)) in /home/.sites/153/site4850561/web/prod/public_html/index.php (line 37)
  1.     Request::setTrustedHosts(explode(','$trustedHosts));
  2. }
  3. $kernel = new Kernel($env$debug);
  4. $request Request::createFromGlobals();
  5. $response $kernel->handle($request);
  6. $response->send();
  7. $kernel->terminate($request$response);

Logs

No log messages

Stack Trace

Twig_Error_Runtime

Twig_Error_Runtime:
Impossible to access an attribute ("number") on a null variable.

  at templates/testimonial/show.html.twig:21
  at twig_get_attribute(object(Twig_Environment), object(Twig_Source), null, 'number', array())
     (var/cache/prod/twig/11/11fad8a6efa4e65a87f5d07f70bf9fa5dbd9365289397c13cc2df9e14d757817.php:108)
  at __TwigTemplate_672efe59f7a19a45e79cf2b3f7611f8c28aa3aefc8a942c57b0fcd36d9d20f86->block_main(array('testimonial' => object(Testimonial), 'app' => object(AppVariable), 'person_portraits_upload_folder' => '/uploads/person_portraits', 'testimonial_images_upload_folder' => '/uploads/testimonial_images', 'testimonial_files_upload_folder' => '/uploads/testimonial_files', 'download_items_upload_folder' => '/uploads/download_items', 'route' => 'testimonial_show', 'route_params' => array('_locale' => 'en', 'id' => '40'), 'params' => array('_locale' => 'en', 'id' => '40')), array('title' => array(object(__TwigTemplate_9a2178b1f7599b019d1c02426b25bc3c1215d8167b99d4e58d8c2ca9726724ed), 'block_title'), 'stylesheets' => array(object(__TwigTemplate_9a2178b1f7599b019d1c02426b25bc3c1215d8167b99d4e58d8c2ca9726724ed), 'block_stylesheets'), 'bodyClass' => array(object(__TwigTemplate_672efe59f7a19a45e79cf2b3f7611f8c28aa3aefc8a942c57b0fcd36d9d20f86), 'block_bodyClass'), 'headerImage' => array(object(__TwigTemplate_672efe59f7a19a45e79cf2b3f7611f8c28aa3aefc8a942c57b0fcd36d9d20f86), 'block_headerImage'), 'headerText' => array(object(__TwigTemplate_672efe59f7a19a45e79cf2b3f7611f8c28aa3aefc8a942c57b0fcd36d9d20f86), 'block_headerText'), 'main' => array(object(__TwigTemplate_672efe59f7a19a45e79cf2b3f7611f8c28aa3aefc8a942c57b0fcd36d9d20f86), 'block_main'), 'javascripts' => array(object(__TwigTemplate_9a2178b1f7599b019d1c02426b25bc3c1215d8167b99d4e58d8c2ca9726724ed), 'block_javascripts')))
     (vendor/twig/twig/lib/Twig/Template.php:189)
  at Twig_Template->displayBlock('main', array('testimonial' => object(Testimonial), 'app' => object(AppVariable), 'person_portraits_upload_folder' => '/uploads/person_portraits', 'testimonial_images_upload_folder' => '/uploads/testimonial_images', 'testimonial_files_upload_folder' => '/uploads/testimonial_files', 'download_items_upload_folder' => '/uploads/download_items', 'route' => 'testimonial_show', 'route_params' => array('_locale' => 'en', 'id' => '40'), 'params' => array('_locale' => 'en', 'id' => '40')), array('title' => array(object(__TwigTemplate_9a2178b1f7599b019d1c02426b25bc3c1215d8167b99d4e58d8c2ca9726724ed), 'block_title'), 'stylesheets' => array(object(__TwigTemplate_9a2178b1f7599b019d1c02426b25bc3c1215d8167b99d4e58d8c2ca9726724ed), 'block_stylesheets'), 'bodyClass' => array(object(__TwigTemplate_672efe59f7a19a45e79cf2b3f7611f8c28aa3aefc8a942c57b0fcd36d9d20f86), 'block_bodyClass'), 'headerImage' => array(object(__TwigTemplate_672efe59f7a19a45e79cf2b3f7611f8c28aa3aefc8a942c57b0fcd36d9d20f86), 'block_headerImage'), 'headerText' => array(object(__TwigTemplate_672efe59f7a19a45e79cf2b3f7611f8c28aa3aefc8a942c57b0fcd36d9d20f86), 'block_headerText'), 'main' => array(object(__TwigTemplate_672efe59f7a19a45e79cf2b3f7611f8c28aa3aefc8a942c57b0fcd36d9d20f86), 'block_main'), 'javascripts' => array(object(__TwigTemplate_9a2178b1f7599b019d1c02426b25bc3c1215d8167b99d4e58d8c2ca9726724ed), 'block_javascripts')))
     (var/cache/prod/twig/98/9841fbf069bd7023f1cdfe1a8ed04b333ff359a6f71629d373f0d064bf803c3e.php:224)
  at __TwigTemplate_9a2178b1f7599b019d1c02426b25bc3c1215d8167b99d4e58d8c2ca9726724ed->doDisplay(array('testimonial' => object(Testimonial), 'app' => object(AppVariable), 'person_portraits_upload_folder' => '/uploads/person_portraits', 'testimonial_images_upload_folder' => '/uploads/testimonial_images', 'testimonial_files_upload_folder' => '/uploads/testimonial_files', 'download_items_upload_folder' => '/uploads/download_items', 'route' => 'testimonial_show', 'route_params' => array('_locale' => 'en', 'id' => '40'), 'params' => array('_locale' => 'en', 'id' => '40')), array('title' => array(object(__TwigTemplate_9a2178b1f7599b019d1c02426b25bc3c1215d8167b99d4e58d8c2ca9726724ed), 'block_title'), 'stylesheets' => array(object(__TwigTemplate_9a2178b1f7599b019d1c02426b25bc3c1215d8167b99d4e58d8c2ca9726724ed), 'block_stylesheets'), 'bodyClass' => array(object(__TwigTemplate_672efe59f7a19a45e79cf2b3f7611f8c28aa3aefc8a942c57b0fcd36d9d20f86), 'block_bodyClass'), 'headerImage' => array(object(__TwigTemplate_672efe59f7a19a45e79cf2b3f7611f8c28aa3aefc8a942c57b0fcd36d9d20f86), 'block_headerImage'), 'headerText' => array(object(__TwigTemplate_672efe59f7a19a45e79cf2b3f7611f8c28aa3aefc8a942c57b0fcd36d9d20f86), 'block_headerText'), 'main' => array(object(__TwigTemplate_672efe59f7a19a45e79cf2b3f7611f8c28aa3aefc8a942c57b0fcd36d9d20f86), 'block_main'), 'javascripts' => array(object(__TwigTemplate_9a2178b1f7599b019d1c02426b25bc3c1215d8167b99d4e58d8c2ca9726724ed), 'block_javascripts')))
     (vendor/twig/twig/lib/Twig/Template.php:390)
  at Twig_Template->displayWithErrorHandling(array('testimonial' => object(Testimonial), 'app' => object(AppVariable), 'person_portraits_upload_folder' => '/uploads/person_portraits', 'testimonial_images_upload_folder' => '/uploads/testimonial_images', 'testimonial_files_upload_folder' => '/uploads/testimonial_files', 'download_items_upload_folder' => '/uploads/download_items'), array('title' => array(object(__TwigTemplate_9a2178b1f7599b019d1c02426b25bc3c1215d8167b99d4e58d8c2ca9726724ed), 'block_title'), 'stylesheets' => array(object(__TwigTemplate_9a2178b1f7599b019d1c02426b25bc3c1215d8167b99d4e58d8c2ca9726724ed), 'block_stylesheets'), 'bodyClass' => array(object(__TwigTemplate_672efe59f7a19a45e79cf2b3f7611f8c28aa3aefc8a942c57b0fcd36d9d20f86), 'block_bodyClass'), 'headerImage' => array(object(__TwigTemplate_672efe59f7a19a45e79cf2b3f7611f8c28aa3aefc8a942c57b0fcd36d9d20f86), 'block_headerImage'), 'headerText' => array(object(__TwigTemplate_672efe59f7a19a45e79cf2b3f7611f8c28aa3aefc8a942c57b0fcd36d9d20f86), 'block_headerText'), 'main' => array(object(__TwigTemplate_672efe59f7a19a45e79cf2b3f7611f8c28aa3aefc8a942c57b0fcd36d9d20f86), 'block_main'), 'javascripts' => array(object(__TwigTemplate_9a2178b1f7599b019d1c02426b25bc3c1215d8167b99d4e58d8c2ca9726724ed), 'block_javascripts')))
     (vendor/twig/twig/lib/Twig/Template.php:367)
  at Twig_Template->display(array('testimonial' => object(Testimonial), 'app' => object(AppVariable), 'person_portraits_upload_folder' => '/uploads/person_portraits', 'testimonial_images_upload_folder' => '/uploads/testimonial_images', 'testimonial_files_upload_folder' => '/uploads/testimonial_files', 'download_items_upload_folder' => '/uploads/download_items'), array('bodyClass' => array(object(__TwigTemplate_672efe59f7a19a45e79cf2b3f7611f8c28aa3aefc8a942c57b0fcd36d9d20f86), 'block_bodyClass'), 'headerImage' => array(object(__TwigTemplate_672efe59f7a19a45e79cf2b3f7611f8c28aa3aefc8a942c57b0fcd36d9d20f86), 'block_headerImage'), 'headerText' => array(object(__TwigTemplate_672efe59f7a19a45e79cf2b3f7611f8c28aa3aefc8a942c57b0fcd36d9d20f86), 'block_headerText'), 'main' => array(object(__TwigTemplate_672efe59f7a19a45e79cf2b3f7611f8c28aa3aefc8a942c57b0fcd36d9d20f86), 'block_main')))
     (var/cache/prod/twig/11/11fad8a6efa4e65a87f5d07f70bf9fa5dbd9365289397c13cc2df9e14d757817.php:34)
  at __TwigTemplate_672efe59f7a19a45e79cf2b3f7611f8c28aa3aefc8a942c57b0fcd36d9d20f86->doDisplay(array('testimonial' => object(Testimonial), 'app' => object(AppVariable), 'person_portraits_upload_folder' => '/uploads/person_portraits', 'testimonial_images_upload_folder' => '/uploads/testimonial_images', 'testimonial_files_upload_folder' => '/uploads/testimonial_files', 'download_items_upload_folder' => '/uploads/download_items'), array('bodyClass' => array(object(__TwigTemplate_672efe59f7a19a45e79cf2b3f7611f8c28aa3aefc8a942c57b0fcd36d9d20f86), 'block_bodyClass'), 'headerImage' => array(object(__TwigTemplate_672efe59f7a19a45e79cf2b3f7611f8c28aa3aefc8a942c57b0fcd36d9d20f86), 'block_headerImage'), 'headerText' => array(object(__TwigTemplate_672efe59f7a19a45e79cf2b3f7611f8c28aa3aefc8a942c57b0fcd36d9d20f86), 'block_headerText'), 'main' => array(object(__TwigTemplate_672efe59f7a19a45e79cf2b3f7611f8c28aa3aefc8a942c57b0fcd36d9d20f86), 'block_main')))
     (vendor/twig/twig/lib/Twig/Template.php:390)
  at Twig_Template->displayWithErrorHandling(array('testimonial' => object(Testimonial), 'app' => object(AppVariable), 'person_portraits_upload_folder' => '/uploads/person_portraits', 'testimonial_images_upload_folder' => '/uploads/testimonial_images', 'testimonial_files_upload_folder' => '/uploads/testimonial_files', 'download_items_upload_folder' => '/uploads/download_items'), array('bodyClass' => array(object(__TwigTemplate_672efe59f7a19a45e79cf2b3f7611f8c28aa3aefc8a942c57b0fcd36d9d20f86), 'block_bodyClass'), 'headerImage' => array(object(__TwigTemplate_672efe59f7a19a45e79cf2b3f7611f8c28aa3aefc8a942c57b0fcd36d9d20f86), 'block_headerImage'), 'headerText' => array(object(__TwigTemplate_672efe59f7a19a45e79cf2b3f7611f8c28aa3aefc8a942c57b0fcd36d9d20f86), 'block_headerText'), 'main' => array(object(__TwigTemplate_672efe59f7a19a45e79cf2b3f7611f8c28aa3aefc8a942c57b0fcd36d9d20f86), 'block_main')))
     (vendor/twig/twig/lib/Twig/Template.php:367)
  at Twig_Template->display(array('testimonial' => object(Testimonial)))
     (vendor/twig/twig/lib/Twig/Template.php:375)
  at Twig_Template->render(array('testimonial' => object(Testimonial)))
     (vendor/twig/twig/lib/Twig/Environment.php:289)
  at Twig_Environment->render('testimonial/show.html.twig', array('testimonial' => object(Testimonial)))
     (vendor/symfony/framework-bundle/Controller/ControllerTrait.php:224)
  at Symfony\Bundle\FrameworkBundle\Controller\AbstractController->render('testimonial/show.html.twig', array('testimonial' => object(Testimonial)))
     (src/Controller/TestimonialController.php:27)
  at App\Controller\TestimonialController->show(40)
     (vendor/symfony/http-kernel/HttpKernel.php:149)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
     (vendor/symfony/http-kernel/HttpKernel.php:66)
  at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
     (vendor/symfony/http-kernel/Kernel.php:188)
  at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
     (/home/.sites/153/site4850561/web/prod/public_html/index.php:37)