logo
Variable "hits" does not exist. (500 Internal Server Error)

Symfony Exception

RuntimeError

HTTP 500 Internal Server Error

Variable "hits" does not exist.

Exception

Twig\Error\ RuntimeError

Show exception properties
Twig\Error\RuntimeError {#2045
  -lineno: 11
  -name: "errors/404.html.twig"
  -rawMessage: "Variable "hits" does not exist."
  -sourcePath: "/var/www/marchebe/wp-content/themes/marchebe/templates/errors/404.html.twig"
  -sourceCode: """
    {% extends "article/base.html.twig" %}\n
    \n
    {% block content %}\n
        <p>Cette page n'existe plus</p>\n
        <br/>\n
        <a href="/">\n
            <p>Retour à la page d'accueil</p>\n
        </a>\n
        <br/>\n
    \n
        {% if hits|length > 0 %}\n
            <p><strong>Voici quelques suggestions émises par le moteur de recherche:</strong></p>\n
            {% include 'search/_results.html.twig' %}\n
        {% endif %}\n
    \n
    {% endblock %}\n
    \n
    {% block image %}\n
        <div class="bg-img w-100 h-220px position-relative h-lg-330px">\n
            <i style="background-image: url('{{ template_directory }}/assets/images/500.jpg')"\n
               class="bg-img-news-1 position-absolute top-0 bottom-0 left-0 right-0 md-left-15px md-right-15px lg-left-0 lg-right-0"></i>\n
        </div>\n
    {% endblock %}\n
    \n
    {% block recommandation %}\n
    \n
    {% endblock %}\n
    """
}
  1. <a href="/">
  2. <p>Retour à la page d'accueil</p>
  3. </a>
  4. <br/>
  5. {% if hits|length > 0 %}
  6. <p><strong>Voici quelques suggestions émises par le moteur de recherche:</strong></p>
  7. {% include 'search/_results.html.twig' %}
  8. {% endif %}
  9. {% endblock %}
  1. </a>
  2. <br/>
  3. ";
  4. // line 11
  5. if ((Twig\Extension\CoreExtension::length($this->env->getCharset(), (isset($context["hits"]) || array_key_exists("hits", $context) ? $context["hits"] : (function () { throw new RuntimeError('Variable "hits" does not exist.', 11, $this->source); })())) > 0)) {
  6. // line 12
  7. yield " <p><strong>Voici quelques suggestions émises par le moteur de recherche:</strong></p>
  8. ";
  9. // line 13
  10. yield from $this->loadTemplate("search/_results.html.twig", "errors/404.html.twig", 13)->unwrap()->yield($context);
  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. // line 57
  2. yield " <div id=\"reading\" class=\"m-3\">
  3. <span>
  4. ";
  5. // line 59
  6. yield from $this->unwrap()->yieldBlock('content', $context, $blocks);
  7. // line 62
  8. yield " </span>
  9. </div>
  10. </div>
  11. </div>
  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. protected function doDisplay(array $context, array $blocks = []): iterable
  2. {
  3. $macros = $this->macros;
  4. $this->parent = $this->loadTemplate("article/base.html.twig", "errors/404.html.twig", 1);
  5. yield from $this->parent->unwrap()->yield($context, array_merge($this->blocks, $blocks));
  6. }
  7. // line 3
  8. /**
  9. * @return iterable<null|scalar|\Stringable>
  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
  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. get_footer();
  2. return;
  3. }
  4. if ($offre == null) {
  5. echo $twig->render(
  6. 'errors/404.html.twig',
  7. [
  8. 'title' => 'Évènement non trouvé',
  9. 'tags' => [],
  10. 'color' => Theme::getColorBlog(Theme::TOURISME),
include('/var/www/marchebe/wp-content/themes/marchebe/single-event.php') in /var/www/marchebe/wp-includes/template-loader.php (line 106)
  1. *
  2. * @param string $template The path of the template to include.
  3. */
  4. $template = apply_filters( 'template_include', $template );
  5. if ( $template ) {
  6. include $template;
  7. } elseif ( current_user_can( 'switch_themes' ) ) {
  8. $theme = wp_get_theme();
  9. if ( $theme->errors() ) {
  10. wp_die( $theme->errors() );
  11. }
require_once('/var/www/marchebe/wp-includes/template-loader.php') in /var/www/marchebe/wp-blog-header.php (line 19)
  1. // Set up the WordPress query.
  2. wp();
  3. // Load the theme template.
  4. require_once ABSPATH . WPINC . '/template-loader.php';
  5. }
require('/var/www/marchebe/wp-blog-header.php') in /var/www/marchebe/index.php (line 17)
  1. * @var bool
  2. */
  3. define( 'WP_USE_THEMES', true );
  4. /** Loads the WordPress Environment and Template */
  5. require __DIR__ . '/wp-blog-header.php';

Stack Trace

RuntimeError
Twig\Error\RuntimeError:
Variable "hits" does not exist.

  at /var/www/marchebe/wp-content/themes/marchebe/templates/errors/404.html.twig:11
  at __TwigTemplate_52063507ed5d242800bde18715d57a00->{closure}()
     (/var/www/marchebe/var/cache/twig/55/5512e329d19fd406b35e573c740ae515.php:69)
  at __TwigTemplate_52063507ed5d242800bde18715d57a00->block_content()
     (/var/www/marchebe/vendor/twig/twig/src/Template.php:432)
  at Twig\Template->yieldBlock()
     (/var/www/marchebe/var/cache/twig/32/3271827b58cbb9e9afbf5b028054e1d0.php:122)
  at __TwigTemplate_5885ec7e716b16b6ce16e2689967acc0->doDisplay()
     (/var/www/marchebe/vendor/twig/twig/src/Template.php:388)
  at Twig\Template->yield()
     (/var/www/marchebe/var/cache/twig/55/5512e329d19fd406b35e573c740ae515.php:49)
  at __TwigTemplate_52063507ed5d242800bde18715d57a00->doDisplay()
     (/var/www/marchebe/vendor/twig/twig/src/Template.php:388)
  at Twig\Template->yield()
     (/var/www/marchebe/vendor/twig/twig/src/Template.php:344)
  at Twig\Template->display()
     (/var/www/marchebe/vendor/twig/twig/src/Template.php:359)
  at Twig\Template->render()
     (/var/www/marchebe/vendor/twig/twig/src/TemplateWrapper.php:51)
  at Twig\TemplateWrapper->render()
     (/var/www/marchebe/vendor/twig/twig/src/Environment.php:334)
  at Twig\Environment->render()
     (/var/www/marchebe/wp-content/themes/marchebe/single-event.php:62)
  at include('/var/www/marchebe/wp-content/themes/marchebe/single-event.php')
     (/var/www/marchebe/wp-includes/template-loader.php:106)
  at require_once('/var/www/marchebe/wp-includes/template-loader.php')
     (/var/www/marchebe/wp-blog-header.php:19)
  at require('/var/www/marchebe/wp-blog-header.php')
     (/var/www/marchebe/index.php:17)