Whoops \ Exception \ ErrorException (E_WARNING)
Attempt to read property "name" on null Whoops\Exception\ErrorException thrown with message "Attempt to read property "name" on null" Stacktrace: #12 Whoops\Exception\ErrorException in /data/websites/webnews/web/app/themes/webnews/src/ViewModel/Post/Templates/Archive.php:44 #11 Whoops\Run:handleError in /data/websites/webnews/web/app/themes/webnews/src/ViewModel/Post/Templates/Archive.php:44 #10 THEME\ViewModel\Post\Templates\Archive:getLabel in /data/websites/webnews/web/app/themes/webnews/src/ViewModel/Post/Templates/Archive.php:17 #9 THEME\ViewModel\Post\Templates\Archive:getPostData in /data/websites/webnews/web/app/themes/webnews/src/ViewModel/Archive.php:140 #8 THEME\ViewModel\Archive:THEME\ViewModel\{closure} in [internal]:0 #7 array_map in /data/websites/webnews/web/app/themes/webnews/src/ViewModel/Archive.php:137 #6 THEME\ViewModel\Archive:doQuery in /data/websites/webnews/web/app/themes/webnews/src/ViewModel/SingleLegacySpecials.php:106 #5 THEME\ViewModel\SingleLegacySpecials:setArticles in /data/websites/webnews/web/app/themes/webnews/src/ViewModel/Archive.php:39 #4 THEME\ViewModel\Archive:__construct in /data/websites/webnews/web/app/themes/webnews/src/ViewModel/SingleLegacySpecials.php:15 #3 THEME\ViewModel\SingleLegacySpecials:__construct in /data/websites/webnews/web/app/themes/webnews/taxonomy-special.php:8 #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 (13)
12
Whoops\Exception\ErrorException
/web/app/themes/webnews/src/ViewModel/Post/Templates/Archive.php44
11
Whoops\Run handleError
/web/app/themes/webnews/src/ViewModel/Post/Templates/Archive.php44
10
THEME\ViewModel\Post\Templates\Archive getLabel
/web/app/themes/webnews/src/ViewModel/Post/Templates/Archive.php17
9
THEME\ViewModel\Post\Templates\Archive getPostData
/web/app/themes/webnews/src/ViewModel/Archive.php140
8
THEME\ViewModel\Archive THEME\ViewModel\{closure}
[internal]0
7
array_map
/web/app/themes/webnews/src/ViewModel/Archive.php137
6
THEME\ViewModel\Archive doQuery
/web/app/themes/webnews/src/ViewModel/SingleLegacySpecials.php106
5
THEME\ViewModel\SingleLegacySpecials setArticles
/web/app/themes/webnews/src/ViewModel/Archive.php39
4
THEME\ViewModel\Archive __construct
/web/app/themes/webnews/src/ViewModel/SingleLegacySpecials.php15
3
THEME\ViewModel\SingleLegacySpecials __construct
/web/app/themes/webnews/taxonomy-special.php8
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/src/ViewModel/Post/Templates/Archive.php
            'tags'         => $this->getTags( $post ),            
            'label'        => $label['text'],
            'label_class'  => $label['tipologia'],
            'label_link'   => $label['link'],
        ];
    }
 
    /**
     * La versione di base ritorna la categoria
     * del post
     * 
     * @param WP_Post $post
     * @return array
     */
    protected function getLabel( $post ) {
 
        $category = $this->getCategory( $post );
 
        return [
            'text'      => $category->name,
            'tipologia' => 'category',
            'link'      => get_term_link( $category )
        ];
    }
 
 
    /**
     * Returns just the sizes needed for archives
     *
     * @param WP_Post $post
     * @return array
     */
    protected function getImage( $post ) {
        
        $featuredImage = new FeaturedImage( $post->ID );
 
        return $featuredImage->sizes(['extra_small', 'extra_small_x2', 'square', 'square_x2', 'minismall', 'minismall_x2', 'small', 'small_x2', 'medium', 'medium_x2' ]);
    }
}
 
/data/websites/webnews/web/app/themes/webnews/src/ViewModel/Post/Templates/Archive.php
            'tags'         => $this->getTags( $post ),            
            'label'        => $label['text'],
            'label_class'  => $label['tipologia'],
            'label_link'   => $label['link'],
        ];
    }
 
    /**
     * La versione di base ritorna la categoria
     * del post
     * 
     * @param WP_Post $post
     * @return array
     */
    protected function getLabel( $post ) {
 
        $category = $this->getCategory( $post );
 
        return [
            'text'      => $category->name,
            'tipologia' => 'category',
            'link'      => get_term_link( $category )
        ];
    }
 
 
    /**
     * Returns just the sizes needed for archives
     *
     * @param WP_Post $post
     * @return array
     */
    protected function getImage( $post ) {
        
        $featuredImage = new FeaturedImage( $post->ID );
 
        return $featuredImage->sizes(['extra_small', 'extra_small_x2', 'square', 'square_x2', 'minismall', 'minismall_x2', 'small', 'small_x2', 'medium', 'medium_x2' ]);
    }
}
 
/data/websites/webnews/web/app/themes/webnews/src/ViewModel/Post/Templates/Archive.php
<?php
 
namespace THEME\ViewModel\Post\Templates;
 
use THEME\ViewModel\Post\Content\FeaturedImage;
 
 
/**
 * Pay attention this is the representation
 * of a POST into an Archive contex\t
 * 
 */
class Archive extends Single implements iTemplate {
    
    public function getPostData( $post ) {
 
        $label = $this->getLabel($post->ID);
 
        return [
            'id'           => $post->ID,
            'title'        => $post->post_title,
            'excerpt'      => $post->post_excerpt,
            'link'         => get_the_permalink( $post->ID ),
            'image'        => $this->getImage( $post ),
            'tags'         => $this->getTags( $post ),            
            'label'        => $label['text'],
            'label_class'  => $label['tipologia'],
            'label_link'   => $label['link'],
        ];
    }
 
    /**
     * La versione di base ritorna la categoria
     * del post
     * 
     * @param WP_Post $post
     * @return array
     */
    protected function getLabel( $post ) {
 
/data/websites/webnews/web/app/themes/webnews/src/ViewModel/Archive.php
        $postTemplate = empty( $postTemplate ) ? $this->postTemplate : $postTemplate;
 
        $args = array_merge( [
 
            'posts_per_page' => Archive::ARCHIVE_POSTS_PER_PAGE,
            'paged'       => 0,
            'post_status' => 'publish'
        ], $args );
 
        // create the query for main contents
        $query = new \WP_Query( $args );
        $posts  = $query->posts;
        
        $tot_pages = $query->max_num_pages;
        
        // as an array of posts
        $posts = array_map( function ( $post ) use ($postTemplate) {
 
            // structured as described by the current template
            return $postTemplate->getPostData( $post );
 
        }, $posts );
        
        return (object) [ 'posts' => $posts, 'tot_pages' =>  $tot_pages ];
    }
 
    /**
     * set the list of the components
     * override this to add or remove components
     */
    protected function initComponents() {
 
        $this->components = [
            'Pagination',            
            'Breadcrumbs',
            'CustomTitle',
            'Adv',
        ];
    }
 
[internal]
/data/websites/webnews/web/app/themes/webnews/src/ViewModel/Archive.php
     */
    protected function doQuery( $args, $postTemplate = null) {
 
        $postTemplate = empty( $postTemplate ) ? $this->postTemplate : $postTemplate;
 
        $args = array_merge( [
 
            'posts_per_page' => Archive::ARCHIVE_POSTS_PER_PAGE,
            'paged'       => 0,
            'post_status' => 'publish'
        ], $args );
 
        // create the query for main contents
        $query = new \WP_Query( $args );
        $posts  = $query->posts;
        
        $tot_pages = $query->max_num_pages;
        
        // as an array of posts
        $posts = array_map( function ( $post ) use ($postTemplate) {
 
            // structured as described by the current template
            return $postTemplate->getPostData( $post );
 
        }, $posts );
        
        return (object) [ 'posts' => $posts, 'tot_pages' =>  $tot_pages ];
    }
 
    /**
     * set the list of the components
     * override this to add or remove components
     */
    protected function initComponents() {
 
        $this->components = [
            'Pagination',            
            'Breadcrumbs',
            'CustomTitle',
            'Adv',
/data/websites/webnews/web/app/themes/webnews/src/ViewModel/SingleLegacySpecials.php
 
        // create the query for main contents
        $args = [            
            'posts_per_page' => 12,
            'paged'          => $this->paged,
            'post_type'      => empty( $this->post_type) ? 'post' : $this->post_type->name,
        ];
 
        if( !empty( $this->term ) ) {
 
            $args [ 'tax_query' ] = [
                [
                    'taxonomy' => $this->term->taxonomy,
                    'field' => 'slug',
                    'terms' => $this->term->slug,
                ]
            ];
        }
        
        $articles = $this->doQuery( $args, $this->postTemplate );
 
        $this->data['articles']  = $articles->posts;
        $this->data['tot_pages'] = $articles->tot_pages;
        
    }
 
}
 
/data/websites/webnews/web/app/themes/webnews/src/ViewModel/Archive.php
 
        $obj_type = empty( $queried_object ) ? '' : get_class( $queried_object ) ; 
 
        $this->term      = ( $obj_type ==  'WP_Term'      ) ? $queried_object : null;
        $this->post_type = ( $obj_type ==  'WP_Post_Type' ) ? $queried_object : null;
        $this->author    = ( $obj_type ==  'WP_User'      ) ? $queried_object : null;
 
        parent::__construct();
 
        // set the postTemplate (default 'Archive')      
        $this->postTemplate    = $this->postTemplateFactory( $postTemplate );
 
        // set the archiveTemplate (default 'Archive') 
        $this->archiveTemplate = $this->archiveTemplateFactory( $archiveTemplate );
 
        // add the current term's data
        $this->setTerm( $obj_type );
 
        // add the articles to data
        $this->setArticles();
 
        // set the components list into property
        // $components
        $this->initComponents();
 
        // add all the default components
        $this->setComponents();
    }
 
 
    /**
     * Writes the basic page informations
     */
    protected function setPageData(){       
        $this->data = [
            'type' => 'archive',
            'infinite' => 'true',
        ];
    }
 
/data/websites/webnews/web/app/themes/webnews/src/ViewModel/SingleLegacySpecials.php
<?php
 
namespace THEME\ViewModel;
 
/**
 * Populate the data
 * using the given post-template
 */
class SingleLegacySpecials extends Archive {
 
    private   $featured = [];
 
    function __construct( $postTemplate = 'Archive', $archiveTemplate = 'SingleLegacySpecials' ) {
 
        parent::__construct( $postTemplate, $archiveTemplate );
 
        $this->setPost();
    }
 
    /**
     * Writes the basic page informations
     */
    protected function setPageData(){
 
        $this->data = [
            'type' => 'single_speciale_legacy',
            'infinite' => 'false'            
        ];
 
    }
 
 
    /**
     * set the list of the components
     * override this to add or remove components
     */
    protected function initComponents() {
 
        $this->components = [
            'Pagination',
/data/websites/webnews/web/app/themes/webnews/taxonomy-special.php
<?php
 
use THEME\ViewModel\SingleLegacySpecials;
use Timber\Timber;
 
$paged = ( get_query_var('paged') && get_query_var('paged') !== 0 ) ? get_query_var('paged') : 1;  
 
$data = ( new SingleLegacySpecials() )->getData();
 
$template = $paged == 1 ? 'single-speciale.twig' : 'archive.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 /speciale/ipad-pro/page/11/
USER nginx
HOME /var/lib/nginx
HTTP_REFERER https://staging.melablog.it/speciale/ipad-pro/page/11
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.128.78.255
HTTP_HOST staging.melablog.it
HTTP_X_FORWARDED_PORT 443
HTTP_X_FORWARDED_PROTO https
REDIRECT_STATUS 200
SERVER_NAME staging.melablog.it
SERVER_PORT 443
SERVER_ADDR 10.50.50.197
REMOTE_PORT 60352
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 1726778138.6488
REQUEST_TIME 1726778138
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 10.50.50.198
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 10.50.50.198
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