Whoops \ Exception \ ErrorException (E_NOTICE)
Undefined offset: 0 Whoops\Exception\ErrorException thrown with message "Undefined offset: 0" Stacktrace: #7 Whoops\Exception\ErrorException in /var/www/html/public/content/themes/pbc/sidebar.php:45 #6 Whoops\Run:handleError in /var/www/html/public/content/themes/pbc/sidebar.php:45 #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
7
Whoops\Exception\ErrorException
/public/content/themes/pbc/sidebar.php45
6
Whoops\Run handleError
/public/content/themes/pbc/sidebar.php45
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/sidebar.php
$tax = false;
$cat = false;
if ( is_tag() ) {
    $context['popular']['title'] = 'Popular in '.ucfirst(single_tag_title( '', false ));
    $tax = 'tag_id';
    $post_type = ['post','podcast_episodes'];
} else if ( is_category() ) {
    $context['popular']['title'] = 'Popular in '.single_cat_title( '', false );
    $tax = 'cat';
} /*else if ( is_post_type_archive() ) {
    $context['popular']['title'] = 'Popular in '.post_type_archive_title( '', false );
}*/
if($tax){
    $the_object = get_queried_object();
    $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/public/content/themes/pbc/sidebar.php
$tax = false;
$cat = false;
if ( is_tag() ) {
    $context['popular']['title'] = 'Popular in '.ucfirst(single_tag_title( '', false ));
    $tax = 'tag_id';
    $post_type = ['post','podcast_episodes'];
} else if ( is_category() ) {
    $context['popular']['title'] = 'Popular in '.single_cat_title( '', false );
    $tax = 'cat';
} /*else if ( is_post_type_archive() ) {
    $context['popular']['title'] = 'Popular in '.post_type_archive_title( '', false );
}*/
if($tax){
    $the_object = get_queried_object();
    $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 1793095375600437542a8916.53476061
Key Value
SERVER_SOFTWARE nginx/1.18.0
REQUEST_URI /other/news-roundup
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-60043754-545586af0ce8752a12bda94c
HTTP_HOST www.prospectmagazine.co.uk
HTTP_X_FORWARDED_PORT 443
HTTP_X_FORWARDED_PROTO https
HTTP_X_FORWARDED_FOR 3.239.40.250
REDIRECT_STATUS 200
SERVER_NAME _
SERVER_PORT 443
SERVER_ADDR 172.17.0.2
REMOTE_PORT 35586
REMOTE_ADDR 172.31.0.255
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 1610889044.1488
REQUEST_TIME 1610889044
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 c199f8d84782
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 c199f8d84782
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