Closed crustamet closed 4 years ago
It would be helpful to know exactly which version of CI4 you are using. I cannot find a commit where that function is on line 960, so my first suggestion is making sure you are using a current release.
It would also be helpful to see the code you are executing that leads to error.
It is the latest update please search for this function cachePage in system/Codeigniter.php line : 959 where it is get called. and 615 where the method is defined.
This file here my brother. https://github.com/codeigniter4/CodeIgniter4/blob/develop/system/CodeIgniter.php
I overrided the Error Page and cache the error page.
That is it.
You understand or i need a more exemplified with code to show.. I think it is very straight forward.
Override the Error from the config with your controller. and inside that Error default function you simply just put $this->cachePage(60);
You will get the error i posted up top.
The call $this->cachePage(60)
is made from a controller?
Yes.. and From the Error override controller.
@crustamet, Please confirm. You did something like this?
$routes->set404Override('App\Errors::show404');
I would really like to see the code
From the Error override controller.
Yes wait i was testing some stuff but i know for sure what is the problem..
So i have this setup
$routes->set404Override('App\Controllers\Errors::showErrorPage');
With this Controller
class Errors extends Controller
{
public function showErrorPage()
{
$this->cachePage(360);
$this->ViewData['LayoutView'] = 'Frontpanel/Errors/Errors';
echo view('master', $this->ViewData);
}
}
if i remove $this->cachePage(360); the error does not show
Thanks. I am able to reproduce the problem. Now to figure out why.
TypeError Argument 1 passed to CodeIgniter\CodeIgniter::cachePage() must be an instance of Config\Cache, null given, called in /projects/ci4/system/CodeIgniter.php on line 960