![]() |
CI4 session_write_close() when redirect - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: CI4 session_write_close() when redirect (/showthread.php?tid=79452) |
CI4 session_write_close() when redirect - Capah.maga - 06-18-2021 I am using CI4 an just learning and never using CI before. I got this error: Code: PHP Fatal error: Uncaught Exception: Serialization of 'Closure' is not allowed in [no active file]:0 Here my Controller: PHP Code: public function create() I already try dumb $Validation before PHP Code: dd( $validation = \Config\Services::validation()); when dumb show all the value. But after redirect there are no value error in validation and i got that error. what that i do wrong? best regards, Capah Maga RE: CI4 session_write_close() when redirect - includebeer - 06-18-2021 PHP Code: ->with('validation', $validation) You can't save $validation in the session like that. It's an instance of the validation library, that's why it crashes in session_write_close(). Here is an example to send the error messages to the redirected page. Use validate() to validate the rules, then use validator to get the error messages. You can see a detailed example in this tutorial: https://includebeer.com/en/blog/how-to-build-a-basic-web-application-with-codeigniter-4-part-6 PHP Code: if ( ! $this->validate($rules)) |