You are on page 1of 2

Codeigniter Troubleshooting

Error: Session Data Lost after redirection in Codeigniter

I am using Codeigniter 3.0.6 and PHP 7.1.2. Problem that I faced is the session data lost after
redirecting to another controller.

Solution :

Upgrading from 3.1.0 to 3.1.1

Before performing an update you should take your site offline by replacing the index.php file with a
static one.

Step 1: Update your CodeIgniter files

Replace all files and directories in your system/ directory.

Error: An uncaught Exception was encountered

Type: Error

Message: Call to undefined method MY_Loader::_ci_object_to_array()

Filename: /Users/k1ut2/Sites/nine.dev/application/third_party/MX/Loader.php

Line Number: 300

Solution :

In application/third_party/MX/Loader.php you can do the following...

Under public function view($view, $vars = array(), $return = FALSE) Look for... (Line 300)

return $this->_ci_load(array('_ci_view' => $view, '_ci_vars' => $this->_ci_object_to_array($vars),


'_ci_return' => $return));

Replace this with

if (method_exists($this, '_ci_object_to_array'))

return $this->_ci_load(array('_ci_view' => $view, '_ci_vars' => $this->_ci_object_to_array($vars),


'_ci_return' => $return));

} else {

return $this->_ci_load(array('_ci_view' => $view, '_ci_vars' => $this->_ci_prepare_view_vars($vars),


'_ci_return' => $return));

It's the result of a "little" undocumented change that the CI Devs implemented, which is fine!
https://codeigniter.com/userguide3/installation/upgrade_311.html

https://stackoverflow.com/questions/41557760/codeigniter-hmvc-object-to-array-error

You might also like