Whoops \ Exception \ ErrorException (E_WARNING)
count(): Parameter must be an array or an object that implements Countable Whoops\Exception\ErrorException thrown with message "count(): Parameter must be an array or an object that implements Countable" Stacktrace: #8 Whoops\Exception\ErrorException in /var/www/vhosts/divinut.com.br/httpdocs/site/controllers/NoticiaEventoController.php:98 #7 count in /var/www/vhosts/divinut.com.br/httpdocs/site/controllers/NoticiaEventoController.php:98 #6 Controller\NoticiaEventoController:IndexAction in /var/www/vhosts/divinut.com.br/httpdocs/site/controllers/NoticiaEventoController.php:383 #5 Controller\NoticiaEventoController:CategoriaAction in /var/www/vhosts/divinut.com.br/httpdocs/site/controllers/DefaultController.php:141 #4 call_user_func_array in /var/www/vhosts/divinut.com.br/httpdocs/site/controllers/DefaultController.php:141 #3 Controller\DefaultController:ResolveSlug in /var/www/vhosts/divinut.com.br/httpdocs/site/controllers/DefaultController.php:18 #2 Controller\DefaultController:IndexAction in /var/www/vhosts/divinut.com.br/httpdocs/lib/Router.php:179 #1 call_user_func_array in /var/www/vhosts/divinut.com.br/httpdocs/lib/Router.php:179 #0 Lib\Router:init in /var/www/vhosts/divinut.com.br/httpdocs/index.php:158
Stack frames (9)
8
Whoops\Exception\ErrorException
/site/controllers/NoticiaEventoController.php98
7
count
/site/controllers/NoticiaEventoController.php98
6
Controller\NoticiaEventoController IndexAction
/site/controllers/NoticiaEventoController.php383
5
Controller\NoticiaEventoController CategoriaAction
/site/controllers/DefaultController.php141
4
call_user_func_array
/site/controllers/DefaultController.php141
3
Controller\DefaultController ResolveSlug
/site/controllers/DefaultController.php18
2
Controller\DefaultController IndexAction
/lib/Router.php179
1
call_user_func_array
/lib/Router.php179
0
Lib\Router init
/index.php158
/var/www/vhosts/divinut.com.br/httpdocs/site/controllers/NoticiaEventoController.php
                $posts = \Lib\Util::Busca2($posts,$keyword);
            }
        }
        
        $itensPagina = 10;
        $sort = $req->Get('sort', 'destaque_desc,data_desc,ordenamento_desc');
        $rows = (int)$req->Get('rows', $itensPagina);
        $page = (int)$req->Get('page', 1);
        
        if ('' == $sort) {
            $sort = 'destaque_desc,data_desc,ordenamento_desc';
        }
        if (1 > $rows) {
            $rows = $itensPagina;
        }
        if (1 > $page) {
            $page = 1;
        }
        
        $total = count($posts);
        $pages = ceil($total / $rows);
        
        if ($page > $pages) {
            $page = $pages;
        }
        
        $offset = ($page - 1) * $rows;
        
        $posts = Util::Sort($posts,$sort);
        
        $posts = array_slice($posts, $offset, $rows);
        
        $extras['posts'] = $posts;
        
        if (isset($categoria->id)) {
            $categoria->url = $req->controller.'/'.$categoria->slug;
            $req->uri = $categoria->url;
            
            
            /* METATAG */ 
/var/www/vhosts/divinut.com.br/httpdocs/site/controllers/NoticiaEventoController.php
                $posts = \Lib\Util::Busca2($posts,$keyword);
            }
        }
        
        $itensPagina = 10;
        $sort = $req->Get('sort', 'destaque_desc,data_desc,ordenamento_desc');
        $rows = (int)$req->Get('rows', $itensPagina);
        $page = (int)$req->Get('page', 1);
        
        if ('' == $sort) {
            $sort = 'destaque_desc,data_desc,ordenamento_desc';
        }
        if (1 > $rows) {
            $rows = $itensPagina;
        }
        if (1 > $page) {
            $page = 1;
        }
        
        $total = count($posts);
        $pages = ceil($total / $rows);
        
        if ($page > $pages) {
            $page = $pages;
        }
        
        $offset = ($page - 1) * $rows;
        
        $posts = Util::Sort($posts,$sort);
        
        $posts = array_slice($posts, $offset, $rows);
        
        $extras['posts'] = $posts;
        
        if (isset($categoria->id)) {
            $categoria->url = $req->controller.'/'.$categoria->slug;
            $req->uri = $categoria->url;
            
            
            /* METATAG */ 
/var/www/vhosts/divinut.com.br/httpdocs/site/controllers/NoticiaEventoController.php
                 
                    parent::IndexAction($req, $res, $extras);
                }
                
                public static function PostAction($req, $res, $extras = array()) {
                    $req->controller = 'posts';
                    $req->method = 'interna';
                    
                    static::InternaAction($req, $res, $extras); 
                    
                }
                
                public static function CategoriaAction($req, $res, $extras = array()) {

                    list($categoria_slug) = $req->params;
                    
                    $categoria = \Models\Blog\Categorias::getBySlug($categoria_slug);
                    $req->method = $categoria->slug;
                    
                    static::IndexAction($req, $res, $extras);
                }
                
                
                public static function ImportarAction($req, $res, $extras = array()) {
                    
                    \Models\Blog\Importador::Importar();
                    
                    parent::IndexAction($req, $res, $extras);
                }
                
                
            }
/var/www/vhosts/divinut.com.br/httpdocs/site/controllers/DefaultController.php
            return $res->redirect('404');
        }
 
        //$req->params = array($slug);
        
        
        $req->params_old = $req->params;
        
        //trigger_error('1:' .print_r($req->params,1));
 
        $req->params = array();
        $req->params[] = $slug;
        if (!in_array($req->method, array('index'))) {
            $req->params[] = $req->method;
        }
        $req->params = array_merge($req->params, $req->params_old);
        $req->controller = static::Pascal2KebabCase($matches['controller']);
        $req->method = static::Pascal2KebabCase($matches['method']);
                
        return call_user_func_array('\\Controller\\'.$modulo->site_controller, array($req, $res, $extras));
    }
 
 
}
/var/www/vhosts/divinut.com.br/httpdocs/site/controllers/DefaultController.php
            return $res->redirect('404');
        }
 
        //$req->params = array($slug);
        
        
        $req->params_old = $req->params;
        
        //trigger_error('1:' .print_r($req->params,1));
 
        $req->params = array();
        $req->params[] = $slug;
        if (!in_array($req->method, array('index'))) {
            $req->params[] = $req->method;
        }
        $req->params = array_merge($req->params, $req->params_old);
        $req->controller = static::Pascal2KebabCase($matches['controller']);
        $req->method = static::Pascal2KebabCase($matches['method']);
                
        return call_user_func_array('\\Controller\\'.$modulo->site_controller, array($req, $res, $extras));
    }
 
 
}
/var/www/vhosts/divinut.com.br/httpdocs/site/controllers/DefaultController.php
<?php
 
namespace Controller;
 
use Lib\Config;
use Lib\View;
 
class DefaultController {
    
    
    public static function IndexAction($req,$res, $extraArgs = array()) {
        
        $tpl = $req->controller.'/'.$req->method.'.twig';
        $view_dir = dirname(__DIR__).'/views';
        if (!file_exists($view_dir.'/'.$tpl)) {
            $tpl = 'home/index.twig';
            //$res->redirect('404');
            return static::ResolveSlug($req, $res, $extraArgs);
        }
        
        $defaultArgs = array(
            'req' => $req,
            'res' => $res
        );
        
        $args = $defaultArgs + $extraArgs;
        
        $res->render($tpl,$args);
        
    }
    
    public static function Pascal2KebabCase($input) {
        //return strtolower(preg_replace('/(?<!^)[A-Z]/', '_$0', $input));
        return strtolower(preg_replace('/(?<!^)[A-Z]/', '-$0', $input));
    }
    /*
    public static function ResolveSlug($req, $res, $extras = array()) {
        $slug = $req->controller;
        
        $record = \R::findOne('slugs','deleted = 0 and slug = ? limit 1', array($slug));
/var/www/vhosts/divinut.com.br/httpdocs/lib/Router.php
 
 
                if ($cacheTime !== 0 && !isset($req->get->noCache) && in_array($req->type, array('GET'))) {                    
                    //CacheManager::setup($cache['config']);
                    //$cache = phpFastCache();
 
                    $cache_key = sha1($req->base_url.$req->controller.'/'.$req->method.'/'.join('/',$req->params).'?'.http_build_query((array)$req->get));
 
                    if (\Lib\Cache::exists($cache_key)) {
                        $cached = \Lib\Cache::get($cache_key,function() {});
                    }
 
                    //$cached = $cache->get($cache_key);
                }
 
                if (!$cached) {
                    $res->header('X-Cache','miss');
                    
                    Hooks::call('before-action',array(&$req,&$res));
                    call_user_func_array(array($classname,$method), array($req,&$res));                
                    Hooks::call('after-action',array(&$req,&$res));
                    
                    if ($cacheTime !== 0 && !isset($req->get->noCache) && in_array($req->type, array('GET'))) {            
                        \Lib\Cache::set($cache_key, $res->export());
 
                        /*
                        $res->on('background',function($cache,$cache_key,$res,$cacheTime){
                            $cache->set($cache_key,$res->export(),$cacheTime);
                        },array($cache,$cache_key,$res,$cacheTime));                    
                        */
                    }
                } else {                    
                    $res->import($cached);
                    $res->header('X-Cache','hit');
                }
            }
 
            $req->end_time = microtime(true);
            
 
/var/www/vhosts/divinut.com.br/httpdocs/lib/Router.php
 
 
                if ($cacheTime !== 0 && !isset($req->get->noCache) && in_array($req->type, array('GET'))) {                    
                    //CacheManager::setup($cache['config']);
                    //$cache = phpFastCache();
 
                    $cache_key = sha1($req->base_url.$req->controller.'/'.$req->method.'/'.join('/',$req->params).'?'.http_build_query((array)$req->get));
 
                    if (\Lib\Cache::exists($cache_key)) {
                        $cached = \Lib\Cache::get($cache_key,function() {});
                    }
 
                    //$cached = $cache->get($cache_key);
                }
 
                if (!$cached) {
                    $res->header('X-Cache','miss');
                    
                    Hooks::call('before-action',array(&$req,&$res));
                    call_user_func_array(array($classname,$method), array($req,&$res));                
                    Hooks::call('after-action',array(&$req,&$res));
                    
                    if ($cacheTime !== 0 && !isset($req->get->noCache) && in_array($req->type, array('GET'))) {            
                        \Lib\Cache::set($cache_key, $res->export());
 
                        /*
                        $res->on('background',function($cache,$cache_key,$res,$cacheTime){
                            $cache->set($cache_key,$res->export(),$cacheTime);
                        },array($cache,$cache_key,$res,$cacheTime));                    
                        */
                    }
                } else {                    
                    $res->import($cached);
                    $res->header('X-Cache','hit');
                }
            }
 
            $req->end_time = microtime(true);
            
 
/var/www/vhosts/divinut.com.br/httpdocs/index.php
        $regex = '#^http[s]?:\/\/(www\.)?(' . join("|", $hosts) . ')(\/' . preg_quote($request_uri) . ')?(\/)?(index\.php)?(\/)?#';
        //trigger_error($regex);
        $de = preg_replace('#^http[s]?:\/\/(www\.)?(' . join("|", $hosts) . ')(\/' . preg_quote($request_uri) . ')?(\/)?(index\.php)?(\/)?#', '', $de);
        $para = preg_replace('#^http[s]?:\/\/(www\.)?(' . join("|", $hosts) . ')?(\/)?(index\.php)?(\/)?#', '', $para);
 
        if ($request_uri == $de) {
            $base_url = \Lib\Request::getBaseUrl();
 
            $url = $base_url . $para;
 
 
            //Header( “HTTP/1.1 301 Moved Permanently” );
            header("Location: {$url}");
            exit;
        }
    }
}
 
 
Router::init();
 

Environment & details:

empty
empty
empty
Key Value
orig_referer
empty
Key Value
USER divinut
HOME /var/www/vhosts/divinut.com.br
PATH_TRANSLATED redirect:/./index.php/blog/441/4-seminario-sobre-o-sistema-divinut-de-producao-de-nozes-peca/441/4-seminario-sobre-o-sistema-divinut-de-producao-de-nozes-peca
PATH_INFO /blog/441/4-seminario-sobre-o-sistema-divinut-de-producao-de-nozes-peca
SCRIPT_NAME /index.php
REQUEST_URI /blog/441/4-seminario-sobre-o-sistema-divinut-de-producao-de-nozes-peca
QUERY_STRING
REQUEST_METHOD GET
SERVER_PROTOCOL HTTP/1.0
GATEWAY_INTERFACE CGI/1.1
REDIRECT_URL /blog/441/4-seminario-sobre-o-sistema-divinut-de-producao-de-nozes-peca
REMOTE_PORT 38486
SCRIPT_FILENAME /var/www/vhosts/divinut.com.br/httpdocs/index.php
SERVER_ADMIN root@localhost
CONTEXT_DOCUMENT_ROOT /var/www/vhosts/divinut.com.br/httpdocs
CONTEXT_PREFIX
REQUEST_SCHEME https
DOCUMENT_ROOT /var/www/vhosts/divinut.com.br/httpdocs
REMOTE_ADDR 3.93.173.205
SERVER_PORT 443
SERVER_ADDR 148.72.144.147
SERVER_NAME www.divinut.com.br
SERVER_SOFTWARE Apache
SERVER_SIGNATURE
PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
HTTP_USER_AGENT claudebot
HTTP_ACCEPT */*
HTTP_CONNECTION close
HTTP_X_ACCEL_INTERNAL /internal-nginx-static-location
HTTP_X_REAL_IP 3.93.173.205
HTTP_HOST www.divinut.com.br
proxy-nokeepalive 1
HTTPS on
PASSENGER_DOWNLOAD_NATIVE_SUPPORT_BINARY 0
PASSENGER_COMPILE_NATIVE_SUPPORT_BINARY 0
PERL5LIB /usr/share/awstats/lib:/usr/share/awstats/plugins
SCRIPT_URI https://www.divinut.com.br/blog/441/4-seminario-sobre-o-sistema-divinut-de-producao-de-nozes-peca
SCRIPT_URL /blog/441/4-seminario-sobre-o-sistema-divinut-de-producao-de-nozes-peca
UNIQUE_ID ZfknkfZYCzrGHWEwLbo1fQAAAAQ
REDIRECT_STATUS 200
REDIRECT_HTTPS on
REDIRECT_PASSENGER_DOWNLOAD_NATIVE_SUPPORT_BINARY 0
REDIRECT_PASSENGER_COMPILE_NATIVE_SUPPORT_BINARY 0
REDIRECT_PERL5LIB /usr/share/awstats/lib:/usr/share/awstats/plugins
REDIRECT_SCRIPT_URI https://www.divinut.com.br/blog/441/4-seminario-sobre-o-sistema-divinut-de-producao-de-nozes-peca
REDIRECT_SCRIPT_URL /blog/441/4-seminario-sobre-o-sistema-divinut-de-producao-de-nozes-peca
REDIRECT_UNIQUE_ID ZfknkfZYCzrGHWEwLbo1fQAAAAQ
FCGI_ROLE RESPONDER
PHP_SELF /index.php/blog/441/4-seminario-sobre-o-sistema-divinut-de-producao-de-nozes-peca
REQUEST_TIME_FLOAT 1710827409.2532
REQUEST_TIME 1710827409
empty
0. Whoops\Handler\PrettyPageHandler