Warning: Undefined variable $offers in /data/websites/telefonino/web/app/themes/telefonino/src/ViewModel/Post/Components/AffiliateMarketing/NewsProductBulletPoints.php on line 81

Fatal error: Uncaught TypeError: array_map(): Argument #2 ($array) must be of type array, null given in /data/websites/telefonino/web/app/themes/telefonino/src/ViewModel/Post/Components/AffiliateMarketing/NewsProductBulletPoints.php:81 Stack trace: #0 /data/websites/telefonino/web/app/themes/telefonino/src/ViewModel/Post/Components/AffiliateMarketing/NewsProductBulletPoints.php(81): array_map() #1 /data/websites/telefonino/web/app/themes/telefonino/src/ViewModel/Post/Components/AffiliateMarketing/NewsProductBulletPoints.php(37): THEME\ViewModel\Post\Components\AffiliateMarketing\NewsProductBulletPoints->getOffers() #2 /data/websites/telefonino/web/app/themes/telefonino/src/ViewModel/Single.php(86): THEME\ViewModel\Post\Components\AffiliateMarketing\NewsProductBulletPoints->getData() #3 /data/websites/telefonino/web/app/themes/telefonino/src/ViewModel/Single.php(35): THEME\ViewModel\Single->setComponents() #4 /data/websites/telefonino/web/app/themes/telefonino/single.php(11): THEME\ViewModel\Single->__construct() #5 /data/websites/telefonino/web/wp/wp-includes/template-loader.php(106): include('...') #6 /data/websites/telefonino/web/wp/wp-blog-header.php(19): require_once('...') #7 /data/websites/telefonino/web/index.php(6): require('...') #8 {main} thrown in /data/websites/telefonino/web/app/themes/telefonino/src/ViewModel/Post/Components/AffiliateMarketing/NewsProductBulletPoints.php on line 81
Whoops! There was an error.
Whoops \ Exception \ ErrorException (E_ERROR)
Uncaught TypeError: array_map(): Argument #2 ($array) must be of type array, null given in /data/websites/telefonino/web/app/themes/telefonino/src/ViewModel/Post/Components/AffiliateMarketing/NewsProductBulletPoints.php:81 Stack trace: #0 /data/websites/telefonino/web/app/themes/telefonino/src/ViewModel/Post/Components/AffiliateMarketing/NewsProductBulletPoints.php(81): array_map() #1 /data/websites/telefonino/web/app/themes/telefonino/src/ViewModel/Post/Components/AffiliateMarketing/NewsProductBulletPoints.php(37): THEME\ViewModel\Post\Components\AffiliateMarketing\NewsProductBulletPoints->getOffers() #2 /data/websites/telefonino/web/app/themes/telefonino/src/ViewModel/Single.php(86): THEME\ViewModel\Post\Components\AffiliateMarketing\NewsProductBulletPoints->getData() #3 /data/websites/telefonino/web/app/themes/telefonino/src/ViewModel/Single.php(35): THEME\ViewModel\Single->setComponents() #4 /data/websites/telefonino/web/app/themes/telefonino/single.php(11): THEME\ViewModel\Single->__construct() #5 /data/websites/telefonino/web/wp/wp-includes/template-loader.php(106): include('...') #6 /data/websites/telefonino/web/wp/wp-blog-header.php(19): require_once('...') #7 /data/websites/telefonino/web/index.php(6): require('...') #8 {main} thrown Whoops\Exception\ErrorException thrown with message "Uncaught TypeError: array_map(): Argument #2 ($array) must be of type array, null given in /data/websites/telefonino/web/app/themes/telefonino/src/ViewModel/Post/Components/AffiliateMarketing/NewsProductBulletPoints.php:81 Stack trace: #0 /data/websites/telefonino/web/app/themes/telefonino/src/ViewModel/Post/Components/AffiliateMarketing/NewsProductBulletPoints.php(81): array_map() #1 /data/websites/telefonino/web/app/themes/telefonino/src/ViewModel/Post/Components/AffiliateMarketing/NewsProductBulletPoints.php(37): THEME\ViewModel\Post\Components\AffiliateMarketing\NewsProductBulletPoints->getOffers() #2 /data/websites/telefonino/web/app/themes/telefonino/src/ViewModel/Single.php(86): THEME\ViewModel\Post\Components\AffiliateMarketing\NewsProductBulletPoints->getData() #3 /data/websites/telefonino/web/app/themes/telefonino/src/ViewModel/Single.php(35): THEME\ViewModel\Single->setComponents() #4 /data/websites/telefonino/web/app/themes/telefonino/single.php(11): THEME\ViewModel\Single->__construct() #5 /data/websites/telefonino/web/wp/wp-includes/template-loader.php(106): include('...') #6 /data/websites/telefonino/web/wp/wp-blog-header.php(19): require_once('...') #7 /data/websites/telefonino/web/index.php(6): require('...') #8 {main} thrown" Stacktrace: #2 Whoops\Exception\ErrorException in /data/websites/telefonino/web/app/themes/telefonino/src/ViewModel/Post/Components/AffiliateMarketing/NewsProductBulletPoints.php:81 #1 Whoops\Run:handleError in /data/websites/telefonino/vendor/filp/whoops/src/Whoops/Run.php:514 #0 Whoops\Run:handleShutdown in [internal]:0
Stack frames (3)
2
Whoops\Exception\ErrorException
/web/app/themes/telefonino/src/ViewModel/Post/Components/AffiliateMarketing/NewsProductBulletPoints.php81
1
Whoops\Run handleError
/vendor/filp/whoops/src/Whoops/Run.php514
0
Whoops\Run handleShutdown
[internal]0
/data/websites/telefonino/web/app/themes/telefonino/src/ViewModel/Post/Components/AffiliateMarketing/NewsProductBulletPoints.php
        /// da testare
        //$data = $this->getTaskData();


        /// SOLO PER TEST -->  
        $data = $this->getDirectData();

        $bulletPoints = $data;

        if( empty( $bulletPoints[ 'offers' ] ) || (!empty($bulletPoints[ 'offers' ]) && $bulletPoints[ 'offers' ][0]["price"] == "1")) return [];
        

        $title  = "I prezzi di " . $bulletPoints[ 'product' ] . ": le migliori offerte del Black Friday"; 

        if (isset($bulletPoints[ 'offers' ][0]) && !isset($bulletPoints[ 'offers' ][0]["domination"])){
            /// rimuove la prima offerta
             $offers = array_slice( $bulletPoints[ 'offers' ], 1 );
        }
        /// sostituisce il titolo con il nome del prodotto
        $offers = array_map( fn( $offer ) => array_merge( $offer, [ 'title' => $bulletPoints[ 'product' ] ]) , $offers );

        return [

            'title'    => $title,
            'title_id' => StringHelper::slugify( $title ),
            'text'     => $bulletPoints[ 'best_price_text' ],
            'bullet_points_intro'    => empty( $offers ) ? '' : $bulletPoints[ 'table_price_text' ],
            'offers'   => $offers,
        ];

    }

    private function getDirectData() {

         /// cerca di recuperare il prodotto correlato alla news
         $product = $this->getProduct();

         /// se non c'è esce
         if( empty( $product ) ) return [];
 
/data/websites/telefonino/vendor/filp/whoops/src/Whoops/Run.php
     *
     * @return void
     */
    public function handleShutdown()
    {
        // If we reached this step, we are in shutdown handler.
        // An exception thrown in a shutdown handler will not be propagated
        // to the exception handler. Pass that information along.
        $this->canThrowExceptions = false;
 
        $error = $this->system->getLastError();
        if ($error && Misc::isLevelFatal($error['type'])) {
            // If there was a fatal error,
            // it was not handled in handleError yet.
            $this->allowQuit = false;
            $this->handleError(
                $error['type'],
                $error['message'],
                $error['file'],
                $error['line']
            );
        }
    }
 
 
    /**
     * @param InspectorFactoryInterface $factory
     *
     * @return void
     */
    public function setInspectorFactory(InspectorFactoryInterface $factory)
    {
        $this->inspectorFactory = $factory;
    }
 
    public function addFrameFilter($filterCallback)
    {
        if (!is_callable($filterCallback)) {
            throw new \InvalidArgumentException(sprintf(
                "A frame filter must be of type callable, %s type given.", 
[internal]

Environment & details:

empty
empty
empty
empty
empty
Key Value
SERVER_SOFTWARE nginx/1.26.2
REQUEST_URI /notizie/iphone-e-apple-watch-per-studenti-ecco-la-combo-perfetta/
USER nginx
HOME /var/lib/nginx
HTTP_REFERER https://staging.telefonino.net/notizie/iphone-e-apple-watch-per-studenti-ecco-la-combo-perfetta
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.137.200.139
HTTP_HOST staging.telefonino.net
HTTP_X_FORWARDED_PORT 443
HTTP_X_FORWARDED_PROTO https
REDIRECT_STATUS 200
SERVER_NAME staging.telefonino.net
SERVER_PORT 443
SERVER_ADDR 10.50.50.197
REMOTE_PORT 55558
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/telefonino/web
DOCUMENT_URI /index.php
SCRIPT_NAME /index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHOD GET
QUERY_STRING
SCRIPT_FILENAME /data/websites/telefonino/web/index.php
FCGI_ROLE RESPONDER
PHP_SELF /index.php
REQUEST_TIME_FLOAT 1735150743.4527
REQUEST_TIME 1735150743
DB_NAME telefonino
DB_USER telefoninoUSR
DB_PASSWORD .T3lefon!n0.
DB_HOST localhost
DB_PREFIX wp_
GTM_ID GTM-P55CN7W
ASSETS_DIR /app/themes/telefonino/assets
FORMINATOR_NEWSLETTER_FORM_ID 404256
WP_ENV development
WP_HOME https://staging.telefonino.net
WP_SITEURL https://staging.telefonino.net/wp
WP_THEMEPATH https://staging.telefonino.net/app/themes/telefonino/
WP_EMAIL no-reply@telefonino.net
WP_DEBUG true
WP_CACHE false
DISABLE_WP_CRON true
WP_MEMORY_LIMIT 512M
WP_POST_REVISIONS false
AUTH_KEY &uq&p$ypr;Yr7DiuR3ECXHD14o0M562d|MYpdP>;X.fm9q@pOvJ^D-/w9uC+`q1z
SECURE_AUTH_KEY *kkFy7N_9]uNEIk%lG{zxv|aT/_BSV:-|l+C{NU|2/|-HJqP82K[e7mg=>qX!Mef
LOGGED_IN_KEY RJ%0[1(1^$bKjvj^IXV!e[%+yD;d1_fl/)Q4/SdSO>>np:+=`+Es9UbS]dOg89J=
NONCE_KEY 1RTq(</}tixMOUC^n44?.,xA!,n-ms-6J@,LS@/aVJAk8<Ofvjaeu[1iPzU,oG{q
AUTH_SALT ,ptA@)1JrYHO3CjZxYcqX_v<7@X1>2*v7K<Ul2?ofl2qP<>!qzjkf)$Zu&iovz-k
SECURE_AUTH_SALT GA/axYdH9ls=wCH#1XwF9P&E<jOP^d4VKlFF?>vb4Czz3v$jz0dl@DES]&A3D_`^
LOGGED_IN_SALT tWjy]Qb,XQ9%th/9Oi1D;E/L@z-Oo5<TfTSVD-obR;MTyal!SWCcez=fnAGNFlFL
NONCE_SALT aMNhCOYLU+(1URHOor&2^Ux0}9%5eQ1B;MRZ({=XMcw!+42NI3Gx?;,L&Y;yYni]
ACF_PRO_KEY b3JkZXJfaWQ9NzQ2MTV8dHlwZT1kZXZlbG9wZXJ8ZGF0ZT0yMDE2LTAyLTA5IDExOjQ5OjE5
Key Value
DB_NAME telefonino
DB_USER telefoninoUSR
DB_PASSWORD .T3lefon!n0.
DB_HOST localhost
DB_PREFIX wp_
GTM_ID GTM-P55CN7W
ASSETS_DIR /app/themes/telefonino/assets
FORMINATOR_NEWSLETTER_FORM_ID 404256
WP_ENV development
WP_HOME https://staging.telefonino.net
WP_SITEURL https://staging.telefonino.net/wp
WP_THEMEPATH https://staging.telefonino.net/app/themes/telefonino/
WP_EMAIL no-reply@telefonino.net
WP_DEBUG true
WP_CACHE false
DISABLE_WP_CRON true
WP_MEMORY_LIMIT 512M
WP_POST_REVISIONS false
AUTH_KEY &uq&p$ypr;Yr7DiuR3ECXHD14o0M562d|MYpdP>;X.fm9q@pOvJ^D-/w9uC+`q1z
SECURE_AUTH_KEY *kkFy7N_9]uNEIk%lG{zxv|aT/_BSV:-|l+C{NU|2/|-HJqP82K[e7mg=>qX!Mef
LOGGED_IN_KEY RJ%0[1(1^$bKjvj^IXV!e[%+yD;d1_fl/)Q4/SdSO>>np:+=`+Es9UbS]dOg89J=
NONCE_KEY 1RTq(</}tixMOUC^n44?.,xA!,n-ms-6J@,LS@/aVJAk8<Ofvjaeu[1iPzU,oG{q
AUTH_SALT ,ptA@)1JrYHO3CjZxYcqX_v<7@X1>2*v7K<Ul2?ofl2qP<>!qzjkf)$Zu&iovz-k
SECURE_AUTH_SALT GA/axYdH9ls=wCH#1XwF9P&E<jOP^d4VKlFF?>vb4Czz3v$jz0dl@DES]&A3D_`^
LOGGED_IN_SALT tWjy]Qb,XQ9%th/9Oi1D;E/L@z-Oo5<TfTSVD-obR;MTyal!SWCcez=fnAGNFlFL
NONCE_SALT aMNhCOYLU+(1URHOor&2^Ux0}9%5eQ1B;MRZ({=XMcw!+42NI3Gx?;,L&Y;yYni]
ACF_PRO_KEY b3JkZXJfaWQ9NzQ2MTV8dHlwZT1kZXZlbG9wZXJ8ZGF0ZT0yMDE2LTAyLTA5IDExOjQ5OjE5
0. Whoops\Handler\PrettyPageHandler