Whoops \ Exception \ ErrorException (E_WARNING)
Trying to access array offset on value of type int Whoops\Exception\ErrorException thrown with message "Trying to access array offset on value of type int" Stacktrace: #14 Whoops\Exception\ErrorException in /data/websites/webnews/web/app/themes/webnews/vendor/timber/timber/lib/Core.php:65 #13 Whoops\Run:handleError in /data/websites/webnews/web/app/themes/webnews/vendor/timber/timber/lib/Core.php:65 #12 Timber\Core:import in /data/websites/webnews/web/app/themes/webnews/vendor/timber/timber/lib/Post.php:325 #11 Timber\Post:init in /data/websites/webnews/web/app/themes/webnews/vendor/timber/timber/lib/Post.php:182 #10 Timber\Post:__construct in /data/websites/webnews/web/app/themes/webnews/vendor/timber/timber/lib/PostCollection.php:52 #9 Timber\PostCollection:init in /data/websites/webnews/web/app/themes/webnews/vendor/timber/timber/lib/PostCollection.php:18 #8 Timber\PostCollection:__construct in /data/websites/webnews/web/app/themes/webnews/vendor/timber/timber/lib/QueryIterator.php:85 #7 Timber\QueryIterator:get_posts in /data/websites/webnews/web/app/themes/webnews/vendor/timber/timber/lib/PostQuery.php:45 #6 Timber\PostQuery:__construct in /data/websites/webnews/web/app/themes/webnews/vendor/timber/timber/lib/Timber.php:260 #5 Timber\Timber:get_context in /data/websites/webnews/web/app/themes/webnews/src/ViewModel/Base.php:30 #4 THEME\ViewModel\Base:__construct in /data/websites/webnews/web/app/themes/webnews/src/ViewModel/Single.php:19 #3 THEME\ViewModel\Single:__construct in /data/websites/webnews/web/app/themes/webnews/single.php:16 #2 include in /data/websites/webnews/web/wp/wp-includes/template-loader.php:106 #1 require_once in /data/websites/webnews/web/wp/wp-blog-header.php:19 #0 require in /data/websites/webnews/web/index.php:6
Stack frames (15)
14
Whoops\Exception\ErrorException
/web/app/themes/webnews/vendor/timber/timber/lib/Core.php65
13
Whoops\Run handleError
/web/app/themes/webnews/vendor/timber/timber/lib/Core.php65
12
Timber\Core import
/web/app/themes/webnews/vendor/timber/timber/lib/Post.php325
11
Timber\Post init
/web/app/themes/webnews/vendor/timber/timber/lib/Post.php182
10
Timber\Post __construct
/web/app/themes/webnews/vendor/timber/timber/lib/PostCollection.php52
9
Timber\PostCollection init
/web/app/themes/webnews/vendor/timber/timber/lib/PostCollection.php18
8
Timber\PostCollection __construct
/web/app/themes/webnews/vendor/timber/timber/lib/QueryIterator.php85
7
Timber\QueryIterator get_posts
/web/app/themes/webnews/vendor/timber/timber/lib/PostQuery.php45
6
Timber\PostQuery __construct
/web/app/themes/webnews/vendor/timber/timber/lib/Timber.php260
5
Timber\Timber get_context
/web/app/themes/webnews/src/ViewModel/Base.php30
4
THEME\ViewModel\Base __construct
/web/app/themes/webnews/src/ViewModel/Single.php19
3
THEME\ViewModel\Single __construct
/web/app/themes/webnews/single.php16
2
include
/web/wp/wp-includes/template-loader.php106
1
require_once
/web/wp/wp-blog-header.php19
0
require
/web/index.php6
/data/websites/webnews/web/app/themes/webnews/vendor/timber/timber/lib/Core.php
    }
 
    /**
     * Takes an array or object and adds the properties to the parent object
     * @example
     * ```php
     * $data = array('airplane' => '757-200', 'flight' => '5316');
     * $post = new Timber\Post()
     * $post->import(data);
     * echo $post->airplane; //757-200
     * ```
     * @param array|object $info an object or array you want to grab data from to attach to the Timber object
     */
    public function import( $info, $force = false ) {
        if ( is_object($info) ) {
            $info = get_object_vars($info);
        }
        if ( is_array($info) ) {
            foreach ( $info as $key => $value ) {
                if ( $key === '' || ord($key[0]) === 0 ) {
                    continue;
                }
                if ( !empty($key) && $force ) {
                    $this->$key = $value;
                } else if ( !empty($key) && !method_exists($this, $key) ) {
                    $this->$key = $value;
                }
            }
        }
    }
 
 
    /**
     * @ignore
     * @param string  $key
     * @param mixed   $value
     */
    public function update( $key, $value ) {
        update_metadata($this->object_type, $this->ID, $key, $value);
    }
/data/websites/webnews/web/app/themes/webnews/vendor/timber/timber/lib/Core.php
    }
 
    /**
     * Takes an array or object and adds the properties to the parent object
     * @example
     * ```php
     * $data = array('airplane' => '757-200', 'flight' => '5316');
     * $post = new Timber\Post()
     * $post->import(data);
     * echo $post->airplane; //757-200
     * ```
     * @param array|object $info an object or array you want to grab data from to attach to the Timber object
     */
    public function import( $info, $force = false ) {
        if ( is_object($info) ) {
            $info = get_object_vars($info);
        }
        if ( is_array($info) ) {
            foreach ( $info as $key => $value ) {
                if ( $key === '' || ord($key[0]) === 0 ) {
                    continue;
                }
                if ( !empty($key) && $force ) {
                    $this->$key = $value;
                } else if ( !empty($key) && !method_exists($this, $key) ) {
                    $this->$key = $value;
                }
            }
        }
    }
 
 
    /**
     * @ignore
     * @param string  $key
     * @param mixed   $value
     */
    public function update( $key, $value ) {
        update_metadata($this->object_type, $this->ID, $key, $value);
    }
/data/websites/webnews/web/app/themes/webnews/vendor/timber/timber/lib/Post.php
            return $revision->ID;
        }
 
        return false;
    }
 
    /**
     * Initializes a Post
     * @internal
     * @param integer $pid
     */
    protected function init( $pid = false ) {
        if ( $pid === false ) {
            $pid = get_the_ID();
        }
        if ( is_numeric($pid) ) {
            $this->ID = $pid;
        }
        $post_info = $this->get_info($pid);
        $this->import($post_info);
    }
 
    /**
     * Get the URL that will edit the current post/object
     * @internal
     * @deprecated since 1.0
     * @codeCoverageIgnore
     * @see Timber\Post::edit_link
     * @return bool|string
     */
    public function get_edit_url() {
        return $this->edit_link();
    }
 
    /**
     * updates the post_meta of the current object with the given value
     * @param string $field
     * @param mixed $value
     */
    public function update( $field, $value ) {
/data/websites/webnews/web/app/themes/webnews/vendor/timber/timber/lib/Post.php
     */
    public $slug;
 
    /**
     * @var PostType $_type stores the PostType object for the Post
     */
    protected $__type;
 
    /**
     * If you send the constructor nothing it will try to figure out the current post id based on being inside The_Loop
     * @example
     * ```php
     * $post = new Timber\Post();
     * $other_post = new Timber\Post($random_post_id);
     * ```
     * @param mixed $pid
     */
    public function __construct( $pid = null ) {
        $pid = $this->determine_id($pid);
        $this->init($pid);
    }
 
    /**
     * This is helpful for twig to return properties and methods see: https://github.com/fabpot/Twig/issues/2
     * This is also here to ensure that {{ post.class }} remains usable
     * @return mixed
     */
    public function __get( $field ) {
        if ( 'class' === $field ) {
            return $this->css_class();
        }
        return parent::__get($field);
    }
 
    /**
     * This is helpful for twig to return properties and methods see: https://github.com/fabpot/Twig/issues/2
     * This is also here to ensure that {{ post.class }} remains usable
     * @return mixed
     */
    public function __call( $field, $args ) {
/data/websites/webnews/web/app/themes/webnews/vendor/timber/timber/lib/PostCollection.php
         */
        $posts_iterator = apply_filters('timber/class/posts_iterator', $posts_iterator, $returned_posts, $post_class);
 
        parent::__construct($returned_posts, 0, $posts_iterator);
    }
 
    protected static function init( $posts, $post_class ) {
        $returned_posts = array();
        if ( is_null($posts) ) {
            $posts = array();
        }
        foreach ( $posts as $post_object ) {
            $post_type      = get_post_type($post_object);
            $post_class_use = PostGetter::get_post_class($post_type, $post_class);
 
            // Don't create yet another object if $post_object is already of the right type
            if ( is_a($post_object, $post_class_use) ) {
                $post = $post_object;
            } else {
                $post = new $post_class_use($post_object);
            }
 
            if ( isset($post->ID) ) {
                $returned_posts[] = $post;
            }
        }
 
        return self::maybe_set_preview($returned_posts);
    }
 
 
    public function get_posts() {
        return $this->getArrayCopy();
    }
 
    /**
     * @param array $posts
     * @return array
     */
    public static function maybe_set_preview( $posts ) {
/data/websites/webnews/web/app/themes/webnews/vendor/timber/timber/lib/PostCollection.php
<?php
 
namespace Timber;
 
use Timber\Helper;
use Timber\Post;
 
/**
 * Class PostCollection
 *
 * PostCollections are internal objects used to hold a collection of posts.
 *
 * @package Timber
 */
class PostCollection extends \ArrayObject {
 
    public function __construct( $posts = array(), $post_class = '\Timber\Post' ) {
        $returned_posts = self::init($posts, $post_class);
 
        $posts_iterator = 'Timber\PostsIterator';
 
        /**
         * Filters the PostIterator class to use for a PostCollection.
         *
         * This filter is useful if you need to set special values or globals on each post. Because many plugins still
         * rely on The Loop, a custom PostIterator can make it much easier to integrate third party plugins with Timber.
         *
         * @since 1.4.x
         *
         * @param string $posts_iterator The iterator class to use to loop over posts. Default `Timber\PostsIterator`.
         * @param array  $returned_posts An array of posts.
         * @param string $post_class     The post class to use to extend posts with.
         */
        $posts_iterator = apply_filters('timber/class/posts_iterator', $posts_iterator, $returned_posts, $post_class);
 
        parent::__construct($returned_posts, 0, $posts_iterator);
    }
 
    protected static function init( $posts, $post_class ) {
        $returned_posts = array();
/data/websites/webnews/web/app/themes/webnews/vendor/timber/timber/lib/QueryIterator.php
 
    /**
     * Gets the amount of found posts in the query.
     *
     * @api
     * @since 1.11.1
     *
     * @return int
     */
    public function found_posts() {
        return $this->_query->found_posts;
    }
 
    public function get_pagination( $prefs ) {
        return new Pagination($prefs, $this->_query);
    }
 
    public function get_posts( $return_collection = false ) {
        if ( isset($this->_query->posts) ) {
            $posts = new PostCollection($this->_query->posts, $this->_posts_class);
            return ($return_collection) ? $posts : $posts->get_posts();
        }
    }
 
    //
    // GET POSTS
    //
    public static function get_query_from_array_of_ids( $query = array() ) {
        if ( !is_array($query) || !count($query) ) {
            return null;
        }
 
        return new \WP_Query(array(
                'post_type'=> 'any',
                'ignore_sticky_posts' => true,
                'post__in' => $query,
                'orderby'  => 'post__in',
                'nopaging' => true
            ));
    }
/data/websites/webnews/web/app/themes/webnews/vendor/timber/timber/lib/PostQuery.php
     */
    public $found_posts = null;
 
    protected $userQuery;
    protected $queryIterator;
    protected $pagination = null;
 
    /**
     * @param mixed       $query
     * @param string     $post_class
     */
    public function __construct( $query = false, $post_class = '\Timber\Post' ) {
        $this->userQuery = $query;
        $this->queryIterator = PostGetter::query_posts($query, $post_class);
 
        if ( $this->queryIterator instanceof QueryIterator ) {
            $this->found_posts = $this->queryIterator->found_posts();
        }
 
        $posts = $this->queryIterator->get_posts();
 
        parent::__construct($posts, $post_class);
    }
 
    /**
     * @return mixed the query the user orignally passed
     * to the pagination object
     */
    protected function get_query() {
        return $this->userQuery;
    }
 
    /**
     * Set pagination for the collection. Optionally could be used to get pagination with custom preferences.
     *
     * @param     array $prefs
     * @return     Timber\Pagination object
     */
    public function pagination( $prefs = array() ) {
        if ( !$this->pagination && is_a($this->queryIterator, 'Timber\QueryIterator') ) {
/data/websites/webnews/web/app/themes/webnews/vendor/timber/timber/lib/Timber.php
    }
 
    /**
     * Get context.
     * @api
     * @return array
     */
    public static function get_context() {
        if ( empty(self::$context_cache) ) {
            self::$context_cache['http_host'] = URLHelper::get_scheme().'://'.URLHelper::get_host();
            self::$context_cache['wp_title'] = Helper::get_wp_title();
            self::$context_cache['body_class'] = implode(' ', get_body_class());
 
            self::$context_cache['site'] = new Site();
            self::$context_cache['request'] = new Request();
            $user = new User();
            self::$context_cache['user'] = ($user->ID) ? $user : false;
            self::$context_cache['theme'] = self::$context_cache['site']->theme;
 
            self::$context_cache['posts'] = new PostQuery();
 
            /**
             * @deprecated as of Timber 1.3.0
             * @todo remove in Timber 1.4.*
             */
            self::$context_cache['wp_head'] = new FunctionWrapper( 'wp_head' );
            self::$context_cache['wp_footer'] = new FunctionWrapper( 'wp_footer' );
 
            self::$context_cache = apply_filters('timber_context', self::$context_cache);
            self::$context_cache = apply_filters('timber/context', self::$context_cache);
        }
 
 
        return self::$context_cache;
    }
 
    /**
     * Compile a Twig file.
     *
     * Passes data to a Twig file and returns the output.
/data/websites/webnews/web/app/themes/webnews/src/ViewModel/Base.php
 *
 * expose getData()
 *
 * and ask to implement setPageData();
 *
 */
abstract class Base {
 
    protected $data;     // the data to be sent to the views
    protected $context;
    protected $paged;
 
    /**
     * Base constructor
     */
    function __construct() {
        global $paged;
 
        // take the context from Timber
        $this->context = Timber::get_context();
        $this->paged = $paged;
 
        // init the data array
        $this->setPageData();
 
        $this->setHeadAndFooterCore();
 
        // basic components
        $this->setMenu();
        $this->setIsMobile();
 
        $this->setDomain();
 
        $this->setGTM_ID();
 
        //$this->setSidebarsData();
 
        //$this->setTaxonomiesData();
        //$this->setAdvData();
        //$this->setFooterData();
/data/websites/webnews/web/app/themes/webnews/src/ViewModel/Single.php
<?php 
 
namespace THEME\ViewModel;
 
// NOTA PER REFACTORING: fare una funzione che elechi solo i 
 
/**
 * Set data common to all the single contents
 */
class Single extends Base {
 
    protected $post;
    protected $postTemplate;
    
    protected $components;
    
    function __construct($post, $postTemplate = 'Single') {     
        
        parent::__construct();
 
        $this->post = $post;
 
        // assign the post template (default is 'Single')        
        $this->postTemplate = $this->postTemplateFactory($postTemplate);
        
        // init the post template 
        // (includes content details as well)
        $this->setPost(); 
 
        // set the components list into property
        // $components 
        $this->initComponents();
 
        // add all the default components 
        $this->setComponents();
 
    }
 
        
    /**
/data/websites/webnews/web/app/themes/webnews/single.php
<?php
 
use Timber\Timber;
use THEME\ViewModel\Single;
use THEME\ViewModel\SingleMaxReina;
 
if (have_posts()) {
    
    $ajax = ( isset( $_GET['is_ajax_request']) );
 
    /// ottimizzazione per autore secondario di MaxReina
    $secondaryMaxReinaUser = get_user_by('login', WN_SECONDARY_USER_FOR_MAXREINA);
    $singleClass = $posts[0]->post_author == $secondaryMaxReinaUser->ID ? SingleMaxReina::class : Single::class;
    
    // load data
    $data = ( new $singleClass( $posts[0], 'SingleSplittedContent') )->getData();
 
    $template = $ajax ? 'singleAjax.twig' : 'single-notizia.twig';
    
    Timber::render( $template, $data);
}
 
?>
/data/websites/webnews/web/wp/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;
}
 
/data/websites/webnews/web/wp/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';
 
}
 
/data/websites/webnews/web/index.php
<?php
/**
 * WordPress View Bootstrapper
 */
define('WP_USE_THEMES', true);
require __DIR__ . '/wp/wp-blog-header.php';
 

Environment & details:

empty
empty
empty
empty
empty
Key Value
SERVER_SOFTWARE nginx/1.24.0
REQUEST_URI /macbook-pro-retina-windows-4k/
USER nginx
HOME /var/lib/nginx
HTTP_REFERER https://staging.webnews.it/macbook-pro-retina-windows-4k
HTTP_ACCEPT_ENCODING gzip, br, zstd, deflate
HTTP_USER_AGENT Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
HTTP_ACCEPT */*
HTTP_CONNECTION close
HTTP_X_FORWARDED_FOR 3.145.44.192
HTTP_HOST staging.webnews.it
HTTP_X_FORWARDED_PORT 443
HTTP_X_FORWARDED_PROTO https
REDIRECT_STATUS 200
SERVER_NAME staging.webnews.it
SERVER_PORT 443
SERVER_ADDR 10.50.50.197
REMOTE_PORT 35768
REMOTE_ADDR 10.50.50.12
GATEWAY_INTERFACE CGI/1.1
HTTPS on
REQUEST_SCHEME https
SERVER_PROTOCOL HTTP/1.0
DOCUMENT_ROOT /data/websites/webnews/web
DOCUMENT_URI /index.php
SCRIPT_NAME /index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHOD GET
QUERY_STRING
SCRIPT_FILENAME /data/websites/webnews/web/index.php
FCGI_ROLE RESPONDER
PHP_SELF /index.php
REQUEST_TIME_FLOAT 1730833644.3353
REQUEST_TIME 1730833644
WP_ENV staging
WP_HOME https://staging.webnews.it
WP_SITEURL https://staging.webnews.it/wp
WP_DEBUG true
WP_CACHE false
WPLANG it_IT
WP_POST_REVISIONS false
DB_NAME webnews
DB_USER webnewsUSR
DB_PASSWORD M3l4.G4mes.N3ws
DB_HOST 127.0.0.1
GTM_ID_WEBNEWS GTM-P55CN7W
GTM_ID_MELABLOG GTM-P55CN7W
GTM_ID_GAMESBLOG GTM-P55CN7W
SITE_SPECIAL_TAXONOMY special
HTML_PRODUCT_POST_TYPE_SLUG prodotti
DISABLE_WP_CRON true
ACF_PRO_KEY b3JkZXJfaWQ9NzQ2MTV8dHlwZT1kZXZlbG9wZXJ8ZGF0ZT0yMDE2LTAyLTA5IDExOjQ5OjE5
WP_ALLOW_MULTISITE true
MULTISITE true
SUBDOMAIN_INSTALL true
DOMAIN_CURRENT_SITE staging.webnews.it
PATH_CURRENT_SITE /
SITE_ID_CURRENT_SITE 1
BLOG_ID_CURRENT_SITE 1
OFFERS_POST_TYPE post
OFFERS_LIMIT 2000
AUTH_KEY E094PtbN,/./X6J)N>X}iRr2X@qzrp<)*n!<1kps=WXH11Ho^1)^#,,/N`RQ%4PA
SECURE_AUTH_KEY rek_-EaoK.j{F>G%}^{Kw+npcA[tI&MW0_:3|Liq*E/]U/ve{M`tRW7[,SX-?G|b
LOGGED_IN_KEY Y;LL^L-^5a5nG&?I;e[nj0<5<;&pprgWk9Eq-Ozp>H6DZwl)3LUtdxQJ-b*mXA/w
NONCE_KEY 1R!zPZ.mPoo=[i1B[dUi2a13}0:>G{BToB:OX_(S8zT+PZ7nlEn78.#t0u7x?9)&
AUTH_SALT e+WE5olbqDvW7C[%Fs}d3n#_@8^,Ha<k&}kBL|:t@*Sl2vs#qT(lw`famVOPZ:!F
SECURE_AUTH_SALT Ks7ArUFaxK%!B`mqAsS;{qC,vpR36AiIcb@N1$[2<^SVY|?11$PV&P[PPzta,N<Z
LOGGED_IN_SALT 8lh7Q,HpTM}CMRtES%GVPD--09e!MUsQbinsA0-lS=qiUFfOaC]*,R?W$Po7UMak
NONCE_SALT m%tOV5u+uWm$e4V|4!y,:K_7`-N=m$unEx>SO:VZGMS)Y!h_ln/#zTJAkM)FK7{2
Key Value
WP_ENV staging
WP_HOME https://staging.webnews.it
WP_SITEURL https://staging.webnews.it/wp
WP_DEBUG true
WP_CACHE false
WPLANG it_IT
WP_POST_REVISIONS false
DB_NAME webnews
DB_USER webnewsUSR
DB_PASSWORD M3l4.G4mes.N3ws
DB_HOST 127.0.0.1
GTM_ID_WEBNEWS GTM-P55CN7W
GTM_ID_MELABLOG GTM-P55CN7W
GTM_ID_GAMESBLOG GTM-P55CN7W
SITE_SPECIAL_TAXONOMY special
HTML_PRODUCT_POST_TYPE_SLUG prodotti
DISABLE_WP_CRON true
ACF_PRO_KEY b3JkZXJfaWQ9NzQ2MTV8dHlwZT1kZXZlbG9wZXJ8ZGF0ZT0yMDE2LTAyLTA5IDExOjQ5OjE5
WP_ALLOW_MULTISITE true
MULTISITE true
SUBDOMAIN_INSTALL true
DOMAIN_CURRENT_SITE staging.webnews.it
PATH_CURRENT_SITE /
SITE_ID_CURRENT_SITE 1
BLOG_ID_CURRENT_SITE 1
OFFERS_POST_TYPE post
OFFERS_LIMIT 2000
AUTH_KEY E094PtbN,/./X6J)N>X}iRr2X@qzrp<)*n!<1kps=WXH11Ho^1)^#,,/N`RQ%4PA
SECURE_AUTH_KEY rek_-EaoK.j{F>G%}^{Kw+npcA[tI&MW0_:3|Liq*E/]U/ve{M`tRW7[,SX-?G|b
LOGGED_IN_KEY Y;LL^L-^5a5nG&?I;e[nj0<5<;&pprgWk9Eq-Ozp>H6DZwl)3LUtdxQJ-b*mXA/w
NONCE_KEY 1R!zPZ.mPoo=[i1B[dUi2a13}0:>G{BToB:OX_(S8zT+PZ7nlEn78.#t0u7x?9)&
AUTH_SALT e+WE5olbqDvW7C[%Fs}d3n#_@8^,Ha<k&}kBL|:t@*Sl2vs#qT(lw`famVOPZ:!F
SECURE_AUTH_SALT Ks7ArUFaxK%!B`mqAsS;{qC,vpR36AiIcb@N1$[2<^SVY|?11$PV&P[PPzta,N<Z
LOGGED_IN_SALT 8lh7Q,HpTM}CMRtES%GVPD--09e!MUsQbinsA0-lS=qiUFfOaC]*,R?W$Po7UMak
NONCE_SALT m%tOV5u+uWm$e4V|4!y,:K_7`-N=m$unEx>SO:VZGMS)Y!h_ln/#zTJAkM)FK7{2
0. Whoops\Handler\PrettyPageHandler