Symfony Exception

RuntimeError

HTTP 500 Internal Server Error

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

Exception

Twig\Error\ RuntimeError

  1. {% extends 'base.html.twig' %}
  2. {% block title %}{{article.title}} - z-miasta.pl{% endblock %}
  3. {% block seo %}
  4.     <META name="Description" content="{{ article.content|raw|striptags|slice(0, 120) ~ '...' }}">
  5. {% endblock %}
  1.     {
  2.         $macros $this->macros;
  3.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  4.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "block""title"));
  5.         echo twig_escape_filter($this->envtwig_get_attribute($this->env$this->source, (isset($context["article"]) || array_key_exists("article"$context) ? $context["article"] : (function () { throw new RuntimeError('Variable "article" does not exist.'3$this->source); })()), "title", [], "any"falsefalsefalse3), "html"nulltrue);
  6.         echo " - z-miasta.pl";
  7.         
  8.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof);
  9.     }
in vendor/twig/twig/src/Template.php -> block_title (line 184)
  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. <html lang=\"pl-PL\">
  2.     <head>
  3.         <meta charset=\"UTF-8\">
  4.         <title>";
  5.         // line 5
  6.         $this->displayBlock('title'$context$blocks);
  7.         echo "</title>
  8.         <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">
  9.         <link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css\" integrity=\"sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm\" crossorigin=\"anonymous\">
  10.         <link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css\">
  11.         <META HTTP-EQUIV=\"Content-Language\" CONTENT=\"pl-PL\">
in vendor/twig/twig/src/Template.php -> doDisplay (line 407)
  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 380)
  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""main/article.html.twig"));
  4.         $this->parent $this->loadTemplate("base.html.twig""main/article.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 407)
  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 380)
  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 392)
  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')) {
  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('main/article.html.twig', array('article' => null, 'controller_name' => 'MainController')) in src/Controller/MainController.php (line 341)
  1.     {
  2.         $article $articleRepository->findOneBy(["slug" => $slug]);
  3.         return $this->render('main/article.html.twig', [
  4.             'article' => $article,
  5.             'controller_name' => 'MainController',
  6.         ]);
  7.     }
  8.     public function footerArticles(ArticleRepository $articleRepository) {
  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 $request$type HttpKernelInterface::MASTER_REQUEST$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.     }
Kernel->handle(object(Request)) in public_html/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:
Impossible to access an attribute ("title") on a null variable.

  at templates/main/article.html.twig:3
  at twig_get_attribute(object(Environment), object(Source), null, 'title', array(), 'any', false, false, false, 3)
     (var/cache/prod/twig/11/11fbf13cbe756893327f99b263e8843ceae773843d564e622ba674b9965056f4.php:60)
  at __TwigTemplate_8ade44239815688885c2fac081bbd3b89a1b57aad759fccf5dc431f732611a8f->block_title(array('article' => null, 'controller_name' => 'MainController', 'app' => object(AppVariable), 'domainNow' => 'z-miasta.pl'), array('title' => array(object(__TwigTemplate_8ade44239815688885c2fac081bbd3b89a1b57aad759fccf5dc431f732611a8f), 'block_title'), 'seo' => array(object(__TwigTemplate_8ade44239815688885c2fac081bbd3b89a1b57aad759fccf5dc431f732611a8f), 'block_seo'), 'stylesheets' => array(object(__TwigTemplate_620a5fca654215f576b56ff2473cd05b6f8e269d0f01184681a197349373b3c5), 'block_stylesheets'), 'body' => array(object(__TwigTemplate_8ade44239815688885c2fac081bbd3b89a1b57aad759fccf5dc431f732611a8f), 'block_body'), 'javascripts' => array(object(__TwigTemplate_620a5fca654215f576b56ff2473cd05b6f8e269d0f01184681a197349373b3c5), 'block_javascripts')))
     (vendor/twig/twig/src/Template.php:184)
  at Twig\Template->displayBlock('title', array('article' => null, 'controller_name' => 'MainController', 'app' => object(AppVariable), 'domainNow' => 'z-miasta.pl'), array('title' => array(object(__TwigTemplate_8ade44239815688885c2fac081bbd3b89a1b57aad759fccf5dc431f732611a8f), 'block_title'), 'seo' => array(object(__TwigTemplate_8ade44239815688885c2fac081bbd3b89a1b57aad759fccf5dc431f732611a8f), 'block_seo'), 'stylesheets' => array(object(__TwigTemplate_620a5fca654215f576b56ff2473cd05b6f8e269d0f01184681a197349373b3c5), 'block_stylesheets'), 'body' => array(object(__TwigTemplate_8ade44239815688885c2fac081bbd3b89a1b57aad759fccf5dc431f732611a8f), 'block_body'), 'javascripts' => array(object(__TwigTemplate_620a5fca654215f576b56ff2473cd05b6f8e269d0f01184681a197349373b3c5), 'block_javascripts')))
     (var/cache/prod/twig/53/535d189ed2fe9f13956d8400d0a013a0b1847a57ca195326210ec4f3dc75b954.php:51)
  at __TwigTemplate_620a5fca654215f576b56ff2473cd05b6f8e269d0f01184681a197349373b3c5->doDisplay(array('article' => null, 'controller_name' => 'MainController', 'app' => object(AppVariable), 'domainNow' => 'z-miasta.pl'), array('title' => array(object(__TwigTemplate_8ade44239815688885c2fac081bbd3b89a1b57aad759fccf5dc431f732611a8f), 'block_title'), 'seo' => array(object(__TwigTemplate_8ade44239815688885c2fac081bbd3b89a1b57aad759fccf5dc431f732611a8f), 'block_seo'), 'stylesheets' => array(object(__TwigTemplate_620a5fca654215f576b56ff2473cd05b6f8e269d0f01184681a197349373b3c5), 'block_stylesheets'), 'body' => array(object(__TwigTemplate_8ade44239815688885c2fac081bbd3b89a1b57aad759fccf5dc431f732611a8f), 'block_body'), 'javascripts' => array(object(__TwigTemplate_620a5fca654215f576b56ff2473cd05b6f8e269d0f01184681a197349373b3c5), 'block_javascripts')))
     (vendor/twig/twig/src/Template.php:407)
  at Twig\Template->displayWithErrorHandling(array('article' => null, 'controller_name' => 'MainController', 'app' => object(AppVariable), 'domainNow' => 'z-miasta.pl'), array('title' => array(object(__TwigTemplate_8ade44239815688885c2fac081bbd3b89a1b57aad759fccf5dc431f732611a8f), 'block_title'), 'seo' => array(object(__TwigTemplate_8ade44239815688885c2fac081bbd3b89a1b57aad759fccf5dc431f732611a8f), 'block_seo'), 'stylesheets' => array(object(__TwigTemplate_620a5fca654215f576b56ff2473cd05b6f8e269d0f01184681a197349373b3c5), 'block_stylesheets'), 'body' => array(object(__TwigTemplate_8ade44239815688885c2fac081bbd3b89a1b57aad759fccf5dc431f732611a8f), 'block_body'), 'javascripts' => array(object(__TwigTemplate_620a5fca654215f576b56ff2473cd05b6f8e269d0f01184681a197349373b3c5), 'block_javascripts')))
     (vendor/twig/twig/src/Template.php:380)
  at Twig\Template->display(array('article' => null, 'controller_name' => 'MainController', 'app' => object(AppVariable), 'domainNow' => 'z-miasta.pl'), array('title' => array(object(__TwigTemplate_8ade44239815688885c2fac081bbd3b89a1b57aad759fccf5dc431f732611a8f), 'block_title'), 'seo' => array(object(__TwigTemplate_8ade44239815688885c2fac081bbd3b89a1b57aad759fccf5dc431f732611a8f), 'block_seo'), 'body' => array(object(__TwigTemplate_8ade44239815688885c2fac081bbd3b89a1b57aad759fccf5dc431f732611a8f), 'block_body')))
     (var/cache/prod/twig/11/11fbf13cbe756893327f99b263e8843ceae773843d564e622ba674b9965056f4.php:47)
  at __TwigTemplate_8ade44239815688885c2fac081bbd3b89a1b57aad759fccf5dc431f732611a8f->doDisplay(array('article' => null, 'controller_name' => 'MainController', 'app' => object(AppVariable), 'domainNow' => 'z-miasta.pl'), array('title' => array(object(__TwigTemplate_8ade44239815688885c2fac081bbd3b89a1b57aad759fccf5dc431f732611a8f), 'block_title'), 'seo' => array(object(__TwigTemplate_8ade44239815688885c2fac081bbd3b89a1b57aad759fccf5dc431f732611a8f), 'block_seo'), 'body' => array(object(__TwigTemplate_8ade44239815688885c2fac081bbd3b89a1b57aad759fccf5dc431f732611a8f), 'block_body')))
     (vendor/twig/twig/src/Template.php:407)
  at Twig\Template->displayWithErrorHandling(array('article' => null, 'controller_name' => 'MainController', 'app' => object(AppVariable), 'domainNow' => 'z-miasta.pl'), array('title' => array(object(__TwigTemplate_8ade44239815688885c2fac081bbd3b89a1b57aad759fccf5dc431f732611a8f), 'block_title'), 'seo' => array(object(__TwigTemplate_8ade44239815688885c2fac081bbd3b89a1b57aad759fccf5dc431f732611a8f), 'block_seo'), 'body' => array(object(__TwigTemplate_8ade44239815688885c2fac081bbd3b89a1b57aad759fccf5dc431f732611a8f), 'block_body')))
     (vendor/twig/twig/src/Template.php:380)
  at Twig\Template->display(array('article' => null, 'controller_name' => 'MainController'))
     (vendor/twig/twig/src/Template.php:392)
  at Twig\Template->render(array('article' => null, 'controller_name' => 'MainController'), array())
     (vendor/twig/twig/src/TemplateWrapper.php:45)
  at Twig\TemplateWrapper->render(array('article' => null, 'controller_name' => 'MainController'))
     (vendor/twig/twig/src/Environment.php:318)
  at Twig\Environment->render('main/article.html.twig', array('article' => null, 'controller_name' => 'MainController'))
     (vendor/symfony/framework-bundle/Controller/ControllerTrait.php:235)
  at Symfony\Bundle\FrameworkBundle\Controller\AbstractController->render('main/article.html.twig', array('article' => null, 'controller_name' => 'MainController'))
     (src/Controller/MainController.php:341)
  at App\Controller\MainController->artykul(object(ArticleRepository), 'lekarz-zdrowia-publicznego-wroclaw')
     (vendor/symfony/http-kernel/HttpKernel.php:146)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
     (vendor/symfony/http-kernel/HttpKernel.php:68)
  at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
     (vendor/symfony/http-kernel/Kernel.php:201)
  at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
     (public_html/index.php:25)