CodeIgniter Forums
Error on activating CSRF protection - Printable Version

+- CodeIgniter Forums (
+-- Forum: Using CodeIgniter (
+--- Forum: General Help (
+--- Thread: Error on activating CSRF protection (/showthread.php?tid=67150)

Error on activating CSRF protection - BabalooAye - 01-21-2017

I'm getting the following error message when I set $config['csrf_protection'] = TRUE:

Fatal error: Class 'CI_Controller' not found in /opt/codeigniter/system/core/CodeIgniter.php on line 369
A PHP Error was encountered

Severity: Error

Message: Class 'CI_Controller' not found

Filename: core/CodeIgniter.php

Line Number: 369


I'm following the manual, but I can't see clear cause for it.

By the way, it only happens when I try to reload by F5 a FORM submited with POST. I know that an error is expected, but I think that it should be shown in an error page (or something), and might be another kind of error.

Anyone can help me out?

RE: Error on activating CSRF protection - BabalooAye - 01-22-2017

My problem is that I modified the "views/errors/error_general.php" to dynamize reporting responses getting variables from CI instance, then, someway, the error response from CSRF protection become misconfigured.

Apparently, this file can not see CI instance, so it is not possible to use instance references in it.

This was fixed by returning the file "views/errors/error_general.php" to the original version, but I'm still studying ways to customize it.

Thanks for the attention.