Twig \ Error \ RuntimeError
An exception has been thrown during the rendering of a template ("Undefined index: issue_cover").
Previous exceptions
  • Undefined index: issue_cover (8)
Twig\Error\RuntimeError thrown with message "An exception has been thrown during the rendering of a template ("Undefined index: issue_cover")." Stacktrace: #30 Twig\Error\RuntimeError in /var/www/html/public/content/themes/pbc/templates/components/sidebar/widget-edition.twig:7 #29 Whoops\Exception\ErrorException in /var/www/html/public/content/themes/pbc/classes/Issue.php:13 #28 Whoops\Run:handleError in /var/www/html/public/content/themes/pbc/classes/Issue.php:13 #27 PBC\Issue:get_cover in /var/www/html/vendor/twig/twig/src/Extension/CoreExtension.php:1507 #26 twig_get_attribute in /var/www/html/vendor/twig/twig/src/Environment.php:418 #25 __TwigTemplate_b45d31ebb5b416d748d780d8daceebad4851d918df7f4d598177df7c14462986___224402659:block_content in /var/www/html/vendor/twig/twig/src/Template.php:182 #24 Twig\Template:displayBlock in /var/www/html/vendor/twig/twig/src/Environment.php:418 #23 __TwigTemplate_1f05b9bd79ff8c4050dcbe96b098be05d733db3d636c1f7cc7a7c061cb8199b1:doDisplay in /var/www/html/vendor/twig/twig/src/Template.php:405 #22 Twig\Template:displayWithErrorHandling in /var/www/html/vendor/twig/twig/src/Template.php:378 #21 Twig\Template:display in /var/www/html/vendor/twig/twig/src/Environment.php:418 #20 __TwigTemplate_b45d31ebb5b416d748d780d8daceebad4851d918df7f4d598177df7c14462986___224402659:doDisplay in /var/www/html/vendor/twig/twig/src/Template.php:405 #19 Twig\Template:displayWithErrorHandling in /var/www/html/vendor/twig/twig/src/Template.php:378 #18 Twig\Template:display in /var/www/html/vendor/twig/twig/src/Environment.php:418 #17 __TwigTemplate_b45d31ebb5b416d748d780d8daceebad4851d918df7f4d598177df7c14462986:doDisplay in /var/www/html/vendor/twig/twig/src/Template.php:405 #16 Twig\Template:displayWithErrorHandling in /var/www/html/vendor/twig/twig/src/Template.php:378 #15 Twig\Template:display in /var/www/html/vendor/twig/twig/src/Environment.php:418 #14 __TwigTemplate_e35d407f86b79714f0ed81d680679ec01a237e85b6270bb2900872adf08b7aae:doDisplay in /var/www/html/vendor/twig/twig/src/Template.php:405 #13 Twig\Template:displayWithErrorHandling in /var/www/html/vendor/twig/twig/src/Template.php:378 #12 Twig\Template:display in /var/www/html/vendor/twig/twig/src/Template.php:390 #11 Twig\Template:render in /var/www/html/vendor/twig/twig/src/TemplateWrapper.php:45 #10 Twig\TemplateWrapper:render in /var/www/html/vendor/timber/timber/lib/Loader.php:79 #9 Timber\Loader:render in /var/www/html/vendor/timber/timber/lib/Timber.php:334 #8 Timber\Timber:compile in /var/www/html/vendor/timber/timber/lib/Timber.php:383 #7 Timber\Timber:fetch in /var/www/html/vendor/timber/timber/lib/Timber.php:410 #6 Timber\Timber:render in /var/www/html/public/content/themes/pbc/sidebar.php:59 #5 include in /var/www/html/vendor/timber/timber/lib/Timber.php:469 #4 Timber\Timber:get_sidebar_from_php in /var/www/html/vendor/timber/timber/lib/Timber.php:450 #3 Timber\Timber:get_sidebar in /var/www/html/public/content/themes/pbc/single.php:18 #2 include in /var/www/html/public/wordpress/wp-includes/template-loader.php:106 #1 require_once in /var/www/html/public/wordpress/wp-blog-header.php:19 #0 require in /var/www/html/public/index.php:14
30
Twig\Error\RuntimeError
/public/content/themes/pbc/templates/components/sidebar/widget-edition.twig7
29
Whoops\Exception\ErrorException
/public/content/themes/pbc/classes/Issue.php13
28
Whoops\Run handleError
/public/content/themes/pbc/classes/Issue.php13
27
PBC\Issue get_cover
/vendor/twig/twig/src/Extension/CoreExtension.php1507
26
twig_get_attribute
/vendor/twig/twig/src/Environment.php418
25
__TwigTemplate_b45d31ebb5b416d748d780d8daceebad4851d918df7f4d598177df7c14462986___224402659 block_content
/vendor/twig/twig/src/Template.php182
24
Twig\Template displayBlock
/vendor/twig/twig/src/Environment.php418
23
__TwigTemplate_1f05b9bd79ff8c4050dcbe96b098be05d733db3d636c1f7cc7a7c061cb8199b1 doDisplay
/vendor/twig/twig/src/Template.php405
22
Twig\Template displayWithErrorHandling
/vendor/twig/twig/src/Template.php378
21
Twig\Template display
/vendor/twig/twig/src/Environment.php418
20
__TwigTemplate_b45d31ebb5b416d748d780d8daceebad4851d918df7f4d598177df7c14462986___224402659 doDisplay
/vendor/twig/twig/src/Template.php405
19
Twig\Template displayWithErrorHandling
/vendor/twig/twig/src/Template.php378
18
Twig\Template display
/vendor/twig/twig/src/Environment.php418
17
__TwigTemplate_b45d31ebb5b416d748d780d8daceebad4851d918df7f4d598177df7c14462986 doDisplay
/vendor/twig/twig/src/Template.php405
16
Twig\Template displayWithErrorHandling
/vendor/twig/twig/src/Template.php378
15
Twig\Template display
/vendor/twig/twig/src/Environment.php418
14
__TwigTemplate_e35d407f86b79714f0ed81d680679ec01a237e85b6270bb2900872adf08b7aae doDisplay
/vendor/twig/twig/src/Template.php405
13
Twig\Template displayWithErrorHandling
/vendor/twig/twig/src/Template.php378
12
Twig\Template display
/vendor/twig/twig/src/Template.php390
11
Twig\Template render
/vendor/twig/twig/src/TemplateWrapper.php45
10
Twig\TemplateWrapper render
/vendor/timber/timber/lib/Loader.php79
9
Timber\Loader render
/vendor/timber/timber/lib/Timber.php334
8
Timber\Timber compile
/vendor/timber/timber/lib/Timber.php383
7
Timber\Timber fetch
/vendor/timber/timber/lib/Timber.php410
6
Timber\Timber render
/public/content/themes/pbc/sidebar.php59
5
include
/vendor/timber/timber/lib/Timber.php469
4
Timber\Timber get_sidebar_from_php
/vendor/timber/timber/lib/Timber.php450
3
Timber\Timber get_sidebar
/public/content/themes/pbc/single.php18
2
include
/public/wordpress/wp-includes/template-loader.php106
1
require_once
/public/wordpress/wp-blog-header.php19
0
require
/public/index.php14
/var/www/html/public/content/themes/pbc/templates/components/sidebar/widget-edition.twig
{% embed 'components/sidebar/widget.twig' with {title: 'Latest Edition', class:'edition'} %}
    {% block content %}
        <div class="widget-edition">
            <div class="row">
                {% if not function('is_preview') %}
                    <div class="widget-edition__image-container widget__image-container">
                        <img src="{{global.magazines|first.get_cover().src}}" alt="{{global.magazines|first.thumbnail.alt}}" class="widget-edition__image">
                    </div>
                {% endif %}
                <div class="widget-edition__content widget__content">{{options.latest_edition_text}}</div>
                <a href="{{global.links.subscribe}}" target="_blank" class="button widget__button widget-edition__button">Join Now</a>
            </div>
        </div>
    {% endblock %}
{% endembed %}
/var/www/html/public/content/themes/pbc/classes/Issue.php
<?php
 
namespace PBC;
 
class Issue extends \PBC\Post {
 
    var $issue_posts = null;
    static $pt = "issues";
 
 
    public function get_cover() {
 
        return new \Timber\Image($this->custom['issue_cover']);
    }
 
    public function issue_number() {
        return $this->custom['issue_number'];
    }
 
    public function get_issue_posts() {
 
 
        if($this->issue_posts){
            return $this->issue_posts;
        }
 
        $this->issue_posts = \Timber\Timber::get_posts([
            "post_type" => "post",
            "post_status" => "public",
            "meta_key" => "_custom_post_type_onomies_relationship",
            "meta_value" => $this->ID,
            "posts_per_page" => 200
 
        ]);
 
        return $this->issue_posts;
 
    }
 
    public function get_issue_posts_sorted_by_category(){
Exception message: Undefined index: issue_cover
/var/www/html/public/content/themes/pbc/classes/Issue.php
<?php
 
namespace PBC;
 
class Issue extends \PBC\Post {
 
    var $issue_posts = null;
    static $pt = "issues";
 
 
    public function get_cover() {
 
        return new \Timber\Image($this->custom['issue_cover']);
    }
 
    public function issue_number() {
        return $this->custom['issue_number'];
    }
 
    public function get_issue_posts() {
 
 
        if($this->issue_posts){
            return $this->issue_posts;
        }
 
        $this->issue_posts = \Timber\Timber::get_posts([
            "post_type" => "post",
            "post_status" => "public",
            "meta_key" => "_custom_post_type_onomies_relationship",
            "meta_value" => $this->ID,
            "posts_per_page" => 200
 
        ]);
 
        return $this->issue_posts;
 
    }
 
    public function get_issue_posts_sorted_by_category(){
/var/www/html/vendor/twig/twig/src/Extension/CoreExtension.php
 
        if ($ignoreStrictCheck || !$env->isStrictVariables()) {
            return;
        }
 
        throw new RuntimeError(sprintf('Neither the property "%1$s" nor one of the methods "%1$s()", "get%1$s()"/"is%1$s()"/"has%1$s()" or "__call()" exist and have public access in class "%2$s".', $item, $class), $lineno, $source);
    }
 
    if ($isDefinedTest) {
        return true;
    }
 
    if ($sandboxed) {
        $env->getExtension(SandboxExtension::class)->checkMethodAllowed($object, $method, $lineno, $source);
    }
 
    // Some objects throw exceptions when they have __call, and the method we try
    // to call is not supported. If ignoreStrictCheck is true, we should return null.
    try {
        $ret = $object->$method(...$arguments);
    } catch (\BadMethodCallException $e) {
        if ($call && ($ignoreStrictCheck || !$env->isStrictVariables())) {
            return;
        }
        throw $e;
    }
 
    return $ret;
}
 
/**
 * Returns the values from a single column in the input array.
 *
 * <pre>
 *  {% set items = [{ 'fruit' : 'apple'}, {'fruit' : 'orange' }] %}
 *
 *  {% set fruits = items|column('fruit') %}
 *
 *  {# fruits now contains ['apple', 'orange'] #}
 * </pre>
/var/www/html/vendor/twig/twig/src/Environment.php
            $key = $this->cache->generateKey($name, $mainCls);
 
            if (!$this->isAutoReload() || $this->isTemplateFresh($name, $this->cache->getTimestamp($key))) {
                $this->cache->load($key);
            }
 
            $source = null;
            if (!class_exists($cls, false)) {
                $source = $this->getLoader()->getSourceContext($name);
                $content = $this->compileSource($source);
                $this->cache->write($key, $content);
                $this->cache->load($key);
 
                if (!class_exists($mainCls, false)) {
                    /* Last line of defense if either $this->bcWriteCacheFile was used,
                     * $this->cache is implemented as a no-op or we have a race condition
                     * where the cache was cleared between the above calls to write to and load from
                     * the cache.
                     */
                    eval('?>'.$content);
                }
 
                if (!class_exists($cls, false)) {
                    throw new RuntimeError(sprintf('Failed to load Twig template "%s", index "%s": cache might be corrupted.', $name, $index), -1, $source);
                }
            }
        }
 
        // to be removed in 3.0
        $this->extensionSet->initRuntime($this);
 
        return $this->loadedTemplates[$cls] = new $cls($this);
    }
 
    /**
     * Creates a template from source.
     *
     * This method should not be used as a generic way to load templates.
     *
     * @param string $template The template source
/var/www/html/vendor/twig/twig/src/Template.php
    {
        if ($useBlocks && isset($blocks[$name])) {
            $template = $blocks[$name][0];
            $block = $blocks[$name][1];
        } elseif (isset($this->blocks[$name])) {
            $template = $this->blocks[$name][0];
            $block = $this->blocks[$name][1];
        } else {
            $template = null;
            $block = null;
        }
 
        // avoid RCEs when sandbox is enabled
        if (null !== $template && !$template instanceof self) {
            throw new \LogicException('A block must be a method on a \Twig\Template instance.');
        }
 
        if (null !== $template) {
            try {
                $template->$block($context, $blocks);
            } catch (Error $e) {
                if (!$e->getSourceContext()) {
                    $e->setSourceContext($template->getSourceContext());
                }
 
                // this is mostly useful for \Twig\Error\LoaderError exceptions
                // see \Twig\Error\LoaderError
                if (-1 === $e->getTemplateLine()) {
                    $e->guess();
                }
 
                throw $e;
            } catch (\Exception $e) {
                $e = new RuntimeError(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $template->getSourceContext(), $e);
                $e->guess();
 
                throw $e;
            }
        } elseif (false !== $parent = $this->getParent($context)) {
            $parent->displayBlock($name, $context, array_merge($this->blocks, $blocks), false, $templateContext ?? $this);
/var/www/html/vendor/twig/twig/src/Environment.php
            $key = $this->cache->generateKey($name, $mainCls);
 
            if (!$this->isAutoReload() || $this->isTemplateFresh($name, $this->cache->getTimestamp($key))) {
                $this->cache->load($key);
            }
 
            $source = null;
            if (!class_exists($cls, false)) {
                $source = $this->getLoader()->getSourceContext($name);
                $content = $this->compileSource($source);
                $this->cache->write($key, $content);
                $this->cache->load($key);
 
                if (!class_exists($mainCls, false)) {
                    /* Last line of defense if either $this->bcWriteCacheFile was used,
                     * $this->cache is implemented as a no-op or we have a race condition
                     * where the cache was cleared between the above calls to write to and load from
                     * the cache.
                     */
                    eval('?>'.$content);
                }
 
                if (!class_exists($cls, false)) {
                    throw new RuntimeError(sprintf('Failed to load Twig template "%s", index "%s": cache might be corrupted.', $name, $index), -1, $source);
                }
            }
        }
 
        // to be removed in 3.0
        $this->extensionSet->initRuntime($this);
 
        return $this->loadedTemplates[$cls] = new $cls($this);
    }
 
    /**
     * Creates a template from source.
     *
     * This method should not be used as a generic way to load templates.
     *
     * @param string $template The template source
/var/www/html/vendor/twig/twig/src/Template.php
        } else {
            ob_start(function () { return ''; });
        }
        try {
            $this->display($context);
        } catch (\Throwable $e) {
            while (ob_get_level() > $level) {
                ob_end_clean();
            }
 
            throw $e;
        }
 
        return ob_get_clean();
    }
 
    protected function displayWithErrorHandling(array $context, array $blocks = [])
    {
        try {
            $this->doDisplay($context, $blocks);
        } catch (Error $e) {
            if (!$e->getSourceContext()) {
                $e->setSourceContext($this->getSourceContext());
            }
 
            // this is mostly useful for \Twig\Error\LoaderError exceptions
            // see \Twig\Error\LoaderError
            if (-1 === $e->getTemplateLine()) {
                $e->guess();
            }
 
            throw $e;
        } catch (\Exception $e) {
            $e = new RuntimeError(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $this->getSourceContext(), $e);
            $e->guess();
 
            throw $e;
        }
    }
 
/var/www/html/vendor/twig/twig/src/Template.php
    {
        return $this;
    }
 
    /**
     * Returns all blocks.
     *
     * This method is for internal use only and should never be called
     * directly.
     *
     * @return array An array of blocks
     */
    public function getBlocks()
    {
        return $this->blocks;
    }
 
    public function display(array $context, array $blocks = [])
    {
        $this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks));
    }
 
    public function render(array $context)
    {
        $level = ob_get_level();
        if ($this->env->isDebug()) {
            ob_start();
        } else {
            ob_start(function () { return ''; });
        }
        try {
            $this->display($context);
        } catch (\Throwable $e) {
            while (ob_get_level() > $level) {
                ob_end_clean();
            }
 
            throw $e;
        }
 
/var/www/html/vendor/twig/twig/src/Environment.php
            $key = $this->cache->generateKey($name, $mainCls);
 
            if (!$this->isAutoReload() || $this->isTemplateFresh($name, $this->cache->getTimestamp($key))) {
                $this->cache->load($key);
            }
 
            $source = null;
            if (!class_exists($cls, false)) {
                $source = $this->getLoader()->getSourceContext($name);
                $content = $this->compileSource($source);
                $this->cache->write($key, $content);
                $this->cache->load($key);
 
                if (!class_exists($mainCls, false)) {
                    /* Last line of defense if either $this->bcWriteCacheFile was used,
                     * $this->cache is implemented as a no-op or we have a race condition
                     * where the cache was cleared between the above calls to write to and load from
                     * the cache.
                     */
                    eval('?>'.$content);
                }
 
                if (!class_exists($cls, false)) {
                    throw new RuntimeError(sprintf('Failed to load Twig template "%s", index "%s": cache might be corrupted.', $name, $index), -1, $source);
                }
            }
        }
 
        // to be removed in 3.0
        $this->extensionSet->initRuntime($this);
 
        return $this->loadedTemplates[$cls] = new $cls($this);
    }
 
    /**
     * Creates a template from source.
     *
     * This method should not be used as a generic way to load templates.
     *
     * @param string $template The template source
/var/www/html/vendor/twig/twig/src/Template.php
        } else {
            ob_start(function () { return ''; });
        }
        try {
            $this->display($context);
        } catch (\Throwable $e) {
            while (ob_get_level() > $level) {
                ob_end_clean();
            }
 
            throw $e;
        }
 
        return ob_get_clean();
    }
 
    protected function displayWithErrorHandling(array $context, array $blocks = [])
    {
        try {
            $this->doDisplay($context, $blocks);
        } catch (Error $e) {
            if (!$e->getSourceContext()) {
                $e->setSourceContext($this->getSourceContext());
            }
 
            // this is mostly useful for \Twig\Error\LoaderError exceptions
            // see \Twig\Error\LoaderError
            if (-1 === $e->getTemplateLine()) {
                $e->guess();
            }
 
            throw $e;
        } catch (\Exception $e) {
            $e = new RuntimeError(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $this->getSourceContext(), $e);
            $e->guess();
 
            throw $e;
        }
    }
 
/var/www/html/vendor/twig/twig/src/Template.php
    {
        return $this;
    }
 
    /**
     * Returns all blocks.
     *
     * This method is for internal use only and should never be called
     * directly.
     *
     * @return array An array of blocks
     */
    public function getBlocks()
    {
        return $this->blocks;
    }
 
    public function display(array $context, array $blocks = [])
    {
        $this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks));
    }
 
    public function render(array $context)
    {
        $level = ob_get_level();
        if ($this->env->isDebug()) {
            ob_start();
        } else {
            ob_start(function () { return ''; });
        }
        try {
            $this->display($context);
        } catch (\Throwable $e) {
            while (ob_get_level() > $level) {
                ob_end_clean();
            }
 
            throw $e;
        }
 
/var/www/html/vendor/twig/twig/src/Environment.php
            $key = $this->cache->generateKey($name, $mainCls);
 
            if (!$this->isAutoReload() || $this->isTemplateFresh($name, $this->cache->getTimestamp($key))) {
                $this->cache->load($key);
            }
 
            $source = null;
            if (!class_exists($cls, false)) {
                $source = $this->getLoader()->getSourceContext($name);
                $content = $this->compileSource($source);
                $this->cache->write($key, $content);
                $this->cache->load($key);
 
                if (!class_exists($mainCls, false)) {
                    /* Last line of defense if either $this->bcWriteCacheFile was used,
                     * $this->cache is implemented as a no-op or we have a race condition
                     * where the cache was cleared between the above calls to write to and load from
                     * the cache.
                     */
                    eval('?>'.$content);
                }
 
                if (!class_exists($cls, false)) {
                    throw new RuntimeError(sprintf('Failed to load Twig template "%s", index "%s": cache might be corrupted.', $name, $index), -1, $source);
                }
            }
        }
 
        // to be removed in 3.0
        $this->extensionSet->initRuntime($this);
 
        return $this->loadedTemplates[$cls] = new $cls($this);
    }
 
    /**
     * Creates a template from source.
     *
     * This method should not be used as a generic way to load templates.
     *
     * @param string $template The template source
/var/www/html/vendor/twig/twig/src/Template.php
        } else {
            ob_start(function () { return ''; });
        }
        try {
            $this->display($context);
        } catch (\Throwable $e) {
            while (ob_get_level() > $level) {
                ob_end_clean();
            }
 
            throw $e;
        }
 
        return ob_get_clean();
    }
 
    protected function displayWithErrorHandling(array $context, array $blocks = [])
    {
        try {
            $this->doDisplay($context, $blocks);
        } catch (Error $e) {
            if (!$e->getSourceContext()) {
                $e->setSourceContext($this->getSourceContext());
            }
 
            // this is mostly useful for \Twig\Error\LoaderError exceptions
            // see \Twig\Error\LoaderError
            if (-1 === $e->getTemplateLine()) {
                $e->guess();
            }
 
            throw $e;
        } catch (\Exception $e) {
            $e = new RuntimeError(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $this->getSourceContext(), $e);
            $e->guess();
 
            throw $e;
        }
    }
 
/var/www/html/vendor/twig/twig/src/Template.php
    {
        return $this;
    }
 
    /**
     * Returns all blocks.
     *
     * This method is for internal use only and should never be called
     * directly.
     *
     * @return array An array of blocks
     */
    public function getBlocks()
    {
        return $this->blocks;
    }
 
    public function display(array $context, array $blocks = [])
    {
        $this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks));
    }
 
    public function render(array $context)
    {
        $level = ob_get_level();
        if ($this->env->isDebug()) {
            ob_start();
        } else {
            ob_start(function () { return ''; });
        }
        try {
            $this->display($context);
        } catch (\Throwable $e) {
            while (ob_get_level() > $level) {
                ob_end_clean();
            }
 
            throw $e;
        }
 
/var/www/html/vendor/twig/twig/src/Environment.php
            $key = $this->cache->generateKey($name, $mainCls);
 
            if (!$this->isAutoReload() || $this->isTemplateFresh($name, $this->cache->getTimestamp($key))) {
                $this->cache->load($key);
            }
 
            $source = null;
            if (!class_exists($cls, false)) {
                $source = $this->getLoader()->getSourceContext($name);
                $content = $this->compileSource($source);
                $this->cache->write($key, $content);
                $this->cache->load($key);
 
                if (!class_exists($mainCls, false)) {
                    /* Last line of defense if either $this->bcWriteCacheFile was used,
                     * $this->cache is implemented as a no-op or we have a race condition
                     * where the cache was cleared between the above calls to write to and load from
                     * the cache.
                     */
                    eval('?>'.$content);
                }
 
                if (!class_exists($cls, false)) {
                    throw new RuntimeError(sprintf('Failed to load Twig template "%s", index "%s": cache might be corrupted.', $name, $index), -1, $source);
                }
            }
        }
 
        // to be removed in 3.0
        $this->extensionSet->initRuntime($this);
 
        return $this->loadedTemplates[$cls] = new $cls($this);
    }
 
    /**
     * Creates a template from source.
     *
     * This method should not be used as a generic way to load templates.
     *
     * @param string $template The template source
/var/www/html/vendor/twig/twig/src/Template.php
        } else {
            ob_start(function () { return ''; });
        }
        try {
            $this->display($context);
        } catch (\Throwable $e) {
            while (ob_get_level() > $level) {
                ob_end_clean();
            }
 
            throw $e;
        }
 
        return ob_get_clean();
    }
 
    protected function displayWithErrorHandling(array $context, array $blocks = [])
    {
        try {
            $this->doDisplay($context, $blocks);
        } catch (Error $e) {
            if (!$e->getSourceContext()) {
                $e->setSourceContext($this->getSourceContext());
            }
 
            // this is mostly useful for \Twig\Error\LoaderError exceptions
            // see \Twig\Error\LoaderError
            if (-1 === $e->getTemplateLine()) {
                $e->guess();
            }
 
            throw $e;
        } catch (\Exception $e) {
            $e = new RuntimeError(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, $this->getSourceContext(), $e);
            $e->guess();
 
            throw $e;
        }
    }
 
/var/www/html/vendor/twig/twig/src/Template.php
    {
        return $this;
    }
 
    /**
     * Returns all blocks.
     *
     * This method is for internal use only and should never be called
     * directly.
     *
     * @return array An array of blocks
     */
    public function getBlocks()
    {
        return $this->blocks;
    }
 
    public function display(array $context, array $blocks = [])
    {
        $this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks));
    }
 
    public function render(array $context)
    {
        $level = ob_get_level();
        if ($this->env->isDebug()) {
            ob_start();
        } else {
            ob_start(function () { return ''; });
        }
        try {
            $this->display($context);
        } catch (\Throwable $e) {
            while (ob_get_level() > $level) {
                ob_end_clean();
            }
 
            throw $e;
        }
 
/var/www/html/vendor/twig/twig/src/Template.php
    public function getBlocks()
    {
        return $this->blocks;
    }
 
    public function display(array $context, array $blocks = [])
    {
        $this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks));
    }
 
    public function render(array $context)
    {
        $level = ob_get_level();
        if ($this->env->isDebug()) {
            ob_start();
        } else {
            ob_start(function () { return ''; });
        }
        try {
            $this->display($context);
        } catch (\Throwable $e) {
            while (ob_get_level() > $level) {
                ob_end_clean();
            }
 
            throw $e;
        }
 
        return ob_get_clean();
    }
 
    protected function displayWithErrorHandling(array $context, array $blocks = [])
    {
        try {
            $this->doDisplay($context, $blocks);
        } catch (Error $e) {
            if (!$e->getSourceContext()) {
                $e->setSourceContext($this->getSourceContext());
            }
 
/var/www/html/vendor/twig/twig/src/TemplateWrapper.php
     * directly (use Twig\Environment::load() instead).
     *
     * @internal
     */
    public function __construct(Environment $env, Template $template)
    {
        $this->env = $env;
        $this->template = $template;
    }
 
    /**
     * Renders the template.
     *
     * @param array $context An array of parameters to pass to the template
     */
    public function render(array $context = []): string
    {
        // using func_get_args() allows to not expose the blocks argument
        // as it should only be used by internal code
        return $this->template->render($context, \func_get_args()[1] ?? []);
    }
 
    /**
     * Displays the template.
     *
     * @param array $context An array of parameters to pass to the template
     */
    public function display(array $context = [])
    {
        // using func_get_args() allows to not expose the blocks argument
        // as it should only be used by internal code
        $this->template->display($context, \func_get_args()[1] ?? []);
    }
 
    /**
     * Checks if a block is defined.
     *
     * @param string $name    The block name
     * @param array  $context An array of parameters to pass to the template
     */
/var/www/html/vendor/timber/timber/lib/Loader.php
 
        $key = null;
        $output = false;
        if ( false !== $expires ) {
            ksort($data);
            $key = md5($file.json_encode($data));
            $output = $this->get_cache($key, self::CACHEGROUP, $cache_mode);
        }
 
        if ( false === $output || null === $output ) {
            $twig = $this->get_twig();
            if ( strlen($file) ) {
                $loader = $this->get_loader();
                $result = $loader->getCacheKey($file);
                do_action('timber_loader_render_file', $result);
            }
            $data = apply_filters('timber_loader_render_data', $data);
            $data = apply_filters('timber/loader/render_data', $data, $file);
            $template = $twig->load($file);
            $output = $template->render($data);
        }
 
        if ( false !== $output && false !== $expires && null !== $key ) {
            $this->delete_cache();
            $this->set_cache($key, $output, self::CACHEGROUP, $expires, $cache_mode);
        }
        $output = apply_filters('timber_output', $output);
        return apply_filters('timber/output', $output, $data, $file);
    }
 
    protected function delete_cache() {
        Cleaner::delete_transients();
    }
 
    /**
     * Get first existing template.
     *
     * @param array|string $templates  Name(s) of the Twig template(s) to choose from.
     * @return string|bool             Name of chosen template, otherwise false.
     */
/var/www/html/vendor/timber/timber/lib/Timber.php
        if ( $via_render ) {
            $file = apply_filters('timber_render_file', $file);
        } else {
            $file = apply_filters('timber_compile_file', $file);
        }
 
        $output = false;
 
        if ($file !== false) {
            if ( is_null($data) ) {
                $data = array();
            }
 
            if ( $via_render ) {
                $data = apply_filters('timber_render_data', $data);
            } else {
                $data = apply_filters('timber_compile_data', $data);
            }
 
            $output = $loader->render($file, $data, $expires, $cache_mode);
        } else {
            if ( is_array($filenames) ) {
                $filenames = implode(", ", $filenames);
            }
            Helper::error_log( 'Error loading your template files: '.$filenames.'. Make sure one of these files exists.' );
        }
 
        do_action('timber_compile_done');
        return $output;
    }
 
    /**
     * Compile a string.
     *
     * @api
     * @example
     * ```php
     * $data = array(
     *     'username' => 'Jane Doe',
     * );
/var/www/html/vendor/timber/timber/lib/Timber.php
        $twig = $dummy_loader->get_twig();
        $template = $twig->createTemplate($string);
        return $template->render($data);
    }
 
    /**
     * Fetch function.
     *
     * @api
     * @param array|string $filenames  Name of the Twig file to render. If this is an array of files, Timber will
     *                                 render the first file that exists.
     * @param array        $data       Optional. An array of data to use in Twig template.
     * @param bool|int     $expires    Optional. In seconds. Use false to disable cache altogether. When passed an
     *                                 array, the first value is used for non-logged in visitors, the second for users.
     *                                 Default false.
     * @param string       $cache_mode Optional. Any of the cache mode constants defined in TimberLoader.
     * @return bool|string The returned output.
     */
    public static function fetch( $filenames, $data = array(), $expires = false, $cache_mode = Loader::CACHE_USE_DEFAULT ) {
        $output = self::compile($filenames, $data, $expires, $cache_mode, true);
        $output = apply_filters('timber_compile_result', $output);
        return $output;
    }
 
    /**
     * Render function.
     *
     * Passes data to a Twig file and echoes the output.
     *
     * @api
     * @example
     * ```php
     * $context = Timber::context();
     *
     * Timber::render( 'index.twig', $context );
     * ```
     * @param array|string $filenames  Name of the Twig file to render. If this is an array of files, Timber will
     *                                 render the first file that exists.
     * @param array        $data       Optional. An array of data to use in Twig template.
     * @param bool|int     $expires    Optional. In seconds. Use false to disable cache altogether. When passed an
/var/www/html/vendor/timber/timber/lib/Timber.php
     * Passes data to a Twig file and echoes the output.
     *
     * @api
     * @example
     * ```php
     * $context = Timber::context();
     *
     * Timber::render( 'index.twig', $context );
     * ```
     * @param array|string $filenames  Name of the Twig file to render. If this is an array of files, Timber will
     *                                 render the first file that exists.
     * @param array        $data       Optional. An array of data to use in Twig template.
     * @param bool|int     $expires    Optional. In seconds. Use false to disable cache altogether. When passed an
     *                                 array, the first value is used for non-logged in visitors, the second for users.
     *                                 Default false.
     * @param string       $cache_mode Optional. Any of the cache mode constants defined in TimberLoader.
     * @return bool|string The echoed output.
     */
    public static function render( $filenames, $data = array(), $expires = false, $cache_mode = Loader::CACHE_USE_DEFAULT ) {
        $output = self::fetch($filenames, $data, $expires, $cache_mode);
        echo $output;
        return $output;
    }
 
    /**
     * Render a string with Twig variables.
     *
     * @api
     * @example
     * ```php
     * $data = array(
     *     'username' => 'Jane Doe',
     * );
     *
     * Timber::render_string( 'Hi {{ username }}, I’m a string with a custom Twig variable', $data );
     * ```
     * @param string $string A string with Twig variables.
     * @param array  $data   An array of data to use in Twig template.
     * @return bool|string
     */
/var/www/html/public/content/themes/pbc/sidebar.php
    $cat = isset($the_object->term_id) ? $the_object->term_id : false;
}
if(is_singular('post')){
    $full_cat = get_the_category();
    $tax = 'cat';
    $cat = $full_cat[0]->term_id;
    $context['popular']['title'] = 'Popular in '.$full_cat[0]->name;
}
 
    //posts[0].category
$opts = [
    'post_type' => $post_type,
    'posts_per_page' => 4,
];
if($tax) $opts[$tax] = $cat;
$context['popular']['posts'] = Timber::get_posts($opts,'\PBC\Post');
 
$context['ad_code'] = "P2_SIDEBAR_".(isset($context['user']) && $context['user'] ? "LOGGED_IN_" : "");
 
Timber::render( array( 'sidebar.twig' ), $context );
wp_reset_query();
/var/www/html/vendor/timber/timber/lib/Timber.php
            return self::get_sidebar_from_php($sidebar, $data);
        }
        return self::compile($sidebar, $data);
    }
 
    /**
     * Get sidebar from PHP
     * @api
     * @param string  $sidebar
     * @param array   $data
     * @return string
     */
    public static function get_sidebar_from_php( $sidebar = '', $data ) {
        $caller = LocationManager::get_calling_script_dir(1);
        $uris = LocationManager::get_locations($caller);
        ob_start();
        $found = false;
        foreach ( $uris as $uri ) {
            if ( file_exists(trailingslashit($uri).$sidebar) ) {
                include trailingslashit($uri).$sidebar;
                $found = true;
                break;
            }
        }
        if ( !$found ) {
            Helper::error_log('error loading your sidebar, check to make sure the file exists');
        }
        $ret = ob_get_contents();
        ob_end_clean();
        return $ret;
    }
 
    /* Widgets
    ================================ */
 
    /**
     * Get widgets.
     *
     * @api
     * @param int|string $widget_id Optional. Index, name or ID of dynamic sidebar. Default 1.
/var/www/html/vendor/timber/timber/lib/Timber.php
    public static function render_string( $string, $data = array() ) {
        $compiled = self::compile_string($string, $data);
        echo $compiled;
        return $compiled;
    }
 
 
    /*  Sidebar
    ================================ */
 
    /**
     * Get sidebar.
     * @api
     * @param string  $sidebar
     * @param array   $data
     * @return bool|string
     */
    public static function get_sidebar( $sidebar = 'sidebar.php', $data = array() ) {
        if ( strstr(strtolower($sidebar), '.php') ) {
            return self::get_sidebar_from_php($sidebar, $data);
        }
        return self::compile($sidebar, $data);
    }
 
    /**
     * Get sidebar from PHP
     * @api
     * @param string  $sidebar
     * @param array   $data
     * @return string
     */
    public static function get_sidebar_from_php( $sidebar = '', $data ) {
        $caller = LocationManager::get_calling_script_dir(1);
        $uris = LocationManager::get_locations($caller);
        ob_start();
        $found = false;
        foreach ( $uris as $uri ) {
            if ( file_exists(trailingslashit($uri).$sidebar) ) {
                include trailingslashit($uri).$sidebar;
                $found = true;
/var/www/html/public/content/themes/pbc/single.php
<?php
/**
 * The Template for displaying all single posts
 *
 * Methods for TimberHelper can be found in the /lib sub-directory
 *
 * @package  WordPress
 * @subpackage  Timber
 * @since    Timber 0.1
 */
 
$context = Timber::get_context();
$post = Timber::query_post();
$categories = $post->categories();
$context['post'] = new \PBC\Post($post);
$context['published_date'] = date('c',strtotime($post->post_date));
$context['modified_date'] = date('c',strtotime($post->post_modified));
$context['sidebar'] = Timber::get_sidebar('sidebar.php', $context);
 
if(is_singular("podcast_episodes")){
    add_filter("the_content", function($content){
        if(strpos($content,'div') && strpos($content,'div') < strpos($content,'img')){
            return preg_replace('@(<div id="attachment_[0-9]+"[\S\s]*?</div>)@m', " ", $content,1);
        }else{
            return preg_replace('@(<p><img loading="lazy" class="alignnone size-full wp-image-[0-9]+"[\S\s]*?/?></p>)@m', " ", $content,1);
        }
    }, 100);
}
 
if(is_singular("post")){
 
    add_filter("the_content", function($content){
        if(strpos($content,'div') && strpos($content,'div') < strpos($content,'img')){
            return preg_replace('@(<div id="attachment_[0-9]+"[\S\s]*?</div>)@m', " ", $content,1);
        }else{
            return preg_replace('@(<p><img loading="lazy" class="alignnone size-full wp-image-[0-9]+"[\S\s]*?/?></p>)@m', " ", $content,1);
        }
    }, 100);
 
    $context['more_from'] = Timber::get_posts([
/var/www/html/public/wordpress/wp-includes/template-loader.php
            }
 
            break;
        }
    }
 
    if ( ! $template ) {
        $template = get_index_template();
    }
 
    /**
     * Filters the path of the current template before including it.
     *
     * @since 3.0.0
     *
     * @param string $template The path of the template to include.
     */
    $template = apply_filters( 'template_include', $template );
    if ( $template ) {
        include $template;
    } elseif ( current_user_can( 'switch_themes' ) ) {
        $theme = wp_get_theme();
        if ( $theme->errors() ) {
            wp_die( $theme->errors() );
        }
    }
    return;
}
 
/var/www/html/public/wordpress/wp-blog-header.php
<?php
/**
 * Loads the WordPress environment and template.
 *
 * @package WordPress
 */
 
if ( ! isset( $wp_did_header ) ) {
 
    $wp_did_header = true;
 
    // Load the WordPress library.
    require_once __DIR__ . '/wp-load.php';
 
    // Set up the WordPress query.
    wp();
 
    // Load the theme template.
    require_once ABSPATH . WPINC . '/template-loader.php';
 
}
 
/var/www/html/public/index.php
<?php
 
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
 
// WordPress view bootstrapper
define( 'WP_USE_THEMES', true );
 
// composer auto loader, symlinks all colliding, this should resolve the relative include paths correctly
//chdir( dirname ( realpath ( __FILE__ ) ) );
 
//require( '../vendor/autoload.php' );
require( './wordpress/wp-blog-header.php');

Environment & details:

empty
empty
empty
empty
Key Value
signup-auth 1123929572600715dcd56867.56723301
Key Value
SERVER_SOFTWARE nginx/1.18.0
REQUEST_URI /economics-and-finance/chinas-private-sector-is-getting-a-bad-deal
USER nobody
HOME /
HTTP_ACCEPT_ENCODING br,gzip
HTTP_ACCEPT_LANGUAGE en-US,en;q=0.5
HTTP_ACCEPT text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_USER_AGENT CCBot/2.0 (https://commoncrawl.org/faq/)
HTTP_X_AMZN_TRACE_ID Root=1-600715dc-46d0b94f3068700358e5c279
HTTP_HOST www.prospectmagazine.co.uk
HTTP_X_FORWARDED_PORT 443
HTTP_X_FORWARDED_PROTO https
HTTP_X_FORWARDED_FOR 3.239.51.78
REDIRECT_STATUS 200
SERVER_NAME _
SERVER_PORT 443
SERVER_ADDR 172.17.0.2
REMOTE_PORT 41580
REMOTE_ADDR 172.31.47.190
GATEWAY_INTERFACE CGI/1.1
HTTPS on
REQUEST_SCHEME https
SERVER_PROTOCOL HTTP/1.1
DOCUMENT_ROOT ********************
DOCUMENT_URI /index.php
SCRIPT_NAME /index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHOD GET
QUERY_STRING
SCRIPT_FILENAME ******************************
FCGI_ROLE RESPONDER
PHP_SELF /index.php
REQUEST_TIME_FLOAT 1611077084.8522
REQUEST_TIME 1611077084
COMPOSER_ALLOW_SUPERUSER 1
DB_HOST *******************************************************************************
DB_NAME *************
DB_PASSWORD ******************
DB_USER ***************
FILE_SYSTEM_ID fs-afce5066
GOOGLE_AD_MANAGER_ACTIVE true
GOOGLE_AD_MANAGER_ID 21688349148
HOSTNAME 607b2bd9e7ce
MAGICK_HOME /usr
MOUNT_DIRECTORY /efs
PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PHP_INI_DIR /etc/php7
PWD /var/www/html
SESSION_SAVE_HANDLER redis
SHLVL 1
WP_ENV **********
WP_HOME **********************************
WP_REDIS_HOST prospect-redis-cache.eui3wf.0001.euw1.cache.amazonaws.com
WP_SITEURL ********************************************
Key Value
COMPOSER_ALLOW_SUPERUSER 1
DB_HOST *******************************************************************************
DB_NAME *************
DB_PASSWORD ******************
DB_USER ***************
FILE_SYSTEM_ID fs-afce5066
GOOGLE_AD_MANAGER_ACTIVE true
GOOGLE_AD_MANAGER_ID 21688349148
HOSTNAME 607b2bd9e7ce
MAGICK_HOME /usr
MOUNT_DIRECTORY /efs
PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PHP_INI_DIR /etc/php7
PWD /var/www/html
SESSION_SAVE_HANDLER redis
SHLVL 1
WP_ENV **********
WP_HOME **********************************
WP_REDIS_HOST prospect-redis-cache.eui3wf.0001.euw1.cache.amazonaws.com
WP_SITEURL ********************************************
0. Whoops\Handler\PrettyPageHandler