Whoops \ Exception \ ErrorException (E_NOTICE)
Trying to get property 'site_controller' of non-object Whoops\Exception\ErrorException thrown with message "Trying to get property 'site_controller' of non-object" Stacktrace: #5 Whoops\Exception\ErrorException in /home/storage/9/0b/28/escolacrescer2/public_html/site/controllers/DefaultController.php:75 #4 Whoops\Run:handleError in /home/storage/9/0b/28/escolacrescer2/public_html/site/controllers/DefaultController.php:75 #3 Controller\DefaultController:ResolveSlug in /home/storage/9/0b/28/escolacrescer2/public_html/site/controllers/DefaultController.php:18 #2 Controller\DefaultController:IndexAction in /home/storage/9/0b/28/escolacrescer2/public_html/lib/Router.php:179 #1 call_user_func_array in /home/storage/9/0b/28/escolacrescer2/public_html/lib/Router.php:179 #0 Lib\Router:init in /home/storage/9/0b/28/escolacrescer2/public_html/index.php:161
Stack frames (6)
5
Whoops\Exception\ErrorException
/site/controllers/DefaultController.php75
4
Whoops\Run handleError
/site/controllers/DefaultController.php75
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.php161
/home/storage/9/0b/28/escolacrescer2/public_html/site/controllers/DefaultController.php
                $Meta2 = \Models\Meta::get('home',$req->language,true);
                $meta->title = $titulo.' - '.$Meta2->title;    
            }
 
            $extras['meta'] = $meta;
            
            $defaultArgs = array(
                'req' => $req,
                'res' => $res
            );
            
            $args = $defaultArgs + $extras;
 
            return $res->render('404/index.twig',$args);
        }
        
        $table = $record->table;
        $modulo = \R::findOne('modulo', 'deleted = 0 and ativo = 1 and folder = ? limit 1', array($table));
        
        if (!preg_match('/^(?<controller>.+)Controller\:\:(?<method>.+)Action$/', $modulo->site_controller, $matches)) {
            //var_dump($modulo->site_controller);exit;
            return $res->redirect('404');
        }
 
        $req->params = array($slug);
        
        $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));
    }
    
    /*
    
    public static function ResolveSlug($req, $res, $extras = array()) {
        $slug = $req->controller;
        
        $record = \R::findOne('slugs','deleted = 0 and slug = ? limit 1', array($slug));
    
        if (!isset($record->id)) {
/home/storage/9/0b/28/escolacrescer2/public_html/site/controllers/DefaultController.php
                $Meta2 = \Models\Meta::get('home',$req->language,true);
                $meta->title = $titulo.' - '.$Meta2->title;    
            }
 
            $extras['meta'] = $meta;
            
            $defaultArgs = array(
                'req' => $req,
                'res' => $res
            );
            
            $args = $defaultArgs + $extras;
 
            return $res->render('404/index.twig',$args);
        }
        
        $table = $record->table;
        $modulo = \R::findOne('modulo', 'deleted = 0 and ativo = 1 and folder = ? limit 1', array($table));
        
        if (!preg_match('/^(?<controller>.+)Controller\:\:(?<method>.+)Action$/', $modulo->site_controller, $matches)) {
            //var_dump($modulo->site_controller);exit;
            return $res->redirect('404');
        }
 
        $req->params = array($slug);
        
        $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));
    }
    
    /*
    
    public static function ResolveSlug($req, $res, $extras = array()) {
        $slug = $req->controller;
        
        $record = \R::findOne('slugs','deleted = 0 and slug = ? limit 1', array($slug));
    
        if (!isset($record->id)) {
/home/storage/9/0b/28/escolacrescer2/public_html/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));
/home/storage/9/0b/28/escolacrescer2/public_html/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);
            
 
/home/storage/9/0b/28/escolacrescer2/public_html/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);
            
 
/home/storage/9/0b/28/escolacrescer2/public_html/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 http://escolacrescer.com.br/3
empty
Key Value
DOCUMENT_ROOT /home/storage/9/0b/28/escolacrescer2/public_html/
GATEWAY_INTERFACE CGI/1.1
HTTPS on
HTTP_ACCEPT */*
HTTP_HOST escolacrescer.com.br
HTTP_REFERER http://escolacrescer.com.br/3
HTTP_USER_AGENT claudebot
LOG_SUBDIR escolacrescer2
PATH /bin:/usr/bin
PHPRC /home/escolacrescer2/
QUERY_STRING
REDIRECT_HTTPS on
REDIRECT_LOG_SUBDIR escolacrescer2
REDIRECT_SCRIPT_URI https://escolacrescer.com.br/3
REDIRECT_SCRIPT_URL /3
REDIRECT_SSL_TLS_SNI escolacrescer.com.br
REDIRECT_STATUS 200
REDIRECT_UNIQUE_ID ZgYALbst8HQAADL-DoMAAABE
REDIRECT_URL /3
REMOTE_ADDR 54.163.200.109
REMOTE_PORT 38686
REQUEST_METHOD GET
REQUEST_URI /3
SCRIPT_FILENAME /home/storage/9/0b/28/escolacrescer2/public_html/index.php
SCRIPT_NAME /index.php
SCRIPT_URI https://escolacrescer.com.br/3
SCRIPT_URL /3
SERVER_ADDR 187.45.240.116
SERVER_ADMIN webmaster@escolacrescer.com.br
SERVER_NAME escolacrescer.com.br
SERVER_PORT 443
SERVER_PROTOCOL HTTP/1.1
SERVER_SIGNATURE
SERVER_SOFTWARE Apache
SSL_TLS_SNI escolacrescer.com.br
SUPHP_URI /index.php/3
UNIQUE_ID ZgYALbst8HQAADL-DoMAAABE
ORIG_PATH_INFO /3
ORIG_PATH_TRANSLATED /home/storage/9/0b/28/escolacrescer2/public_html/index.php
PHP_SELF /index.php
REQUEST_TIME_FLOAT 1711669293.5999
REQUEST_TIME 1711669293
PATH_INFO /3
Key Value
DOCUMENT_ROOT /home/storage/9/0b/28/escolacrescer2/public_html/
GATEWAY_INTERFACE CGI/1.1
HTTPS on
HTTP_ACCEPT */*
HTTP_HOST escolacrescer.com.br
HTTP_REFERER http://escolacrescer.com.br/3
HTTP_USER_AGENT claudebot
LOG_SUBDIR escolacrescer2
PATH /bin:/usr/bin
PHPRC /home/escolacrescer2/
QUERY_STRING
REDIRECT_HTTPS on
REDIRECT_LOG_SUBDIR escolacrescer2
REDIRECT_SCRIPT_URI https://escolacrescer.com.br/3
REDIRECT_SCRIPT_URL /3
REDIRECT_SSL_TLS_SNI escolacrescer.com.br
REDIRECT_STATUS 200
REDIRECT_UNIQUE_ID ZgYALbst8HQAADL-DoMAAABE
REDIRECT_URL /3
REMOTE_ADDR 54.163.200.109
REMOTE_PORT 38686
REQUEST_METHOD GET
REQUEST_URI /3
SCRIPT_FILENAME /home/storage/9/0b/28/escolacrescer2/public_html/index.php
SCRIPT_NAME /index.php
SCRIPT_URI https://escolacrescer.com.br/3
SCRIPT_URL /3
SERVER_ADDR 187.45.240.116
SERVER_ADMIN webmaster@escolacrescer.com.br
SERVER_NAME escolacrescer.com.br
SERVER_PORT 443
SERVER_PROTOCOL HTTP/1.1
SERVER_SIGNATURE
SERVER_SOFTWARE Apache
SSL_TLS_SNI escolacrescer.com.br
SUPHP_URI /index.php/3
UNIQUE_ID ZgYALbst8HQAADL-DoMAAABE
ORIG_PATH_INFO /3
ORIG_PATH_TRANSLATED /home/storage/9/0b/28/escolacrescer2/public_html/index.php
0. Whoops\Handler\PrettyPageHandler