Error
Call to a member function getPosts() on null Error thrown with message "Call to a member function getPosts() on null" Stacktrace: #3 Error in /var/www/vhosts/xn--direitosdascrianas-nvb.com.br/httpdocs/site/controllers/NoticiasController.php:32 #2 Controller\NoticiasController:IndexAction in /var/www/vhosts/xn--direitosdascrianas-nvb.com.br/httpdocs/lib/Router.php:179 #1 call_user_func_array in /var/www/vhosts/xn--direitosdascrianas-nvb.com.br/httpdocs/lib/Router.php:179 #0 Lib\Router:init in /var/www/vhosts/xn--direitosdascrianas-nvb.com.br/httpdocs/index.php:158
Stack frames (4)
3
Error
/site/controllers/NoticiasController.php32
2
Controller\NoticiasController IndexAction
/lib/Router.php179
1
call_user_func_array
/lib/Router.php179
0
Lib\Router init
/index.php158
/var/www/vhosts/xn--direitosdascrianas-nvb.com.br/httpdocs/site/controllers/NoticiasController.php
        
        if (!in_array($req->method, array('index','post'))) {
            $categoria_slug = $req->method;
            $req->method = $categoria_slug;
        }
        
        
        if (preg_match('/^(?<ano>\d{4})-(?<mes>[0-1]\d)$/', $categoria_slug, $matches)) {
            $mes = $matches['mes'];
            $ano = $matches['ano'];
            $posts = array_filter($posts, function($publicao) use ($mes, $ano) {
                return $publicao->ano == $ano && $publicao->mes == $mes;
            });
        } else {
            
            if ('' != $categoria_slug) {
                $categoria = \Models\Blog\Categorias::getBySlug($categoria_slug);
                $extras['categoria'] = $categoria;
                $req->extras[] = $categoria->slug;
                $posts = $categoria->getPosts();
                
            }
            
        }
        
        
        $busca = $req->Get('buscar', '');
        if ('' != $busca) {
            $keywords = \Lib\Util::linkfy($busca);
            $keys = explode('-', $keywords);
            if (count($keys) > 1) {
                $keywords = explode('-', $keywords);
                $keywords = array_unique($keywords);
                foreach($keywords as $keyword) {
                    $posts = \Lib\Util::Busca1($posts,$keyword);
                }
            } else {
                $keyword = $keywords; 
                $posts = \Lib\Util::Busca2($posts,$keyword);
            }
/var/www/vhosts/xn--direitosdascrianas-nvb.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/xn--direitosdascrianas-nvb.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/xn--direitosdascrianas-nvb.com.br/httpdocs/index.php
        $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 direitosdas
HOME /var/www/vhosts/xn--direitosdascrianas-nvb.com.br
PATH_TRANSLATED redirect:/./index.php/noticias/o-amor-não-e-amado-o-grito-contido-de-quem-sofre-violencia-sexual/o-amor-não-e-amado-o-grito-contido-de-quem-sofre-violencia-sexual
PATH_INFO /noticias/o-amor-não-e-amado-o-grito-contido-de-quem-sofre-violencia-sexual
SCRIPT_NAME /index.php
REQUEST_URI /noticias/o-amor-n%C3%A3o-e-amado-o-grito-contido-de-quem-sofre-violencia-sexual
QUERY_STRING
REQUEST_METHOD GET
SERVER_PROTOCOL HTTP/1.0
GATEWAY_INTERFACE CGI/1.1
REDIRECT_URL /noticias/o-amor-não-e-amado-o-grito-contido-de-quem-sofre-violencia-sexual
REMOTE_PORT 48652
SCRIPT_FILENAME /var/www/vhosts/xn--direitosdascrianas-nvb.com.br/httpdocs/index.php
SERVER_ADMIN root@localhost
CONTEXT_DOCUMENT_ROOT /var/www/vhosts/xn--direitosdascrianas-nvb.com.br/httpdocs
CONTEXT_PREFIX
REQUEST_SCHEME https
DOCUMENT_ROOT /var/www/vhosts/xn--direitosdascrianas-nvb.com.br/httpdocs
REMOTE_ADDR 34.203.242.200
SERVER_PORT 443
SERVER_ADDR 148.72.155.248
SERVER_NAME www.xn--direitosdascrianas-nvb.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 34.203.242.200
HTTP_HOST www.xn--direitosdascrianas-nvb.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.xn--direitosdascrianas-nvb.com.br/noticias/o-amor-não-e-amado-o-grito-contido-de-quem-sofre-violencia-sexual
SCRIPT_URL /noticias/o-amor-não-e-amado-o-grito-contido-de-quem-sofre-violencia-sexual
UNIQUE_ID ZgWH@VXVRlJEQt1j-wY-4QAAAJg
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.xn--direitosdascrianas-nvb.com.br/noticias/o-amor-não-e-amado-o-grito-contido-de-quem-sofre-violencia-sexual
REDIRECT_SCRIPT_URL /noticias/o-amor-não-e-amado-o-grito-contido-de-quem-sofre-violencia-sexual
REDIRECT_UNIQUE_ID ZgWH@VXVRlJEQt1j-wY-4QAAAJg
FCGI_ROLE RESPONDER
PHP_SELF /index.php/noticias/o-amor-não-e-amado-o-grito-contido-de-quem-sofre-violencia-sexual
REQUEST_TIME_FLOAT 1711638521.9508
REQUEST_TIME 1711638521
empty
0. Whoops\Handler\PrettyPageHandler