Upgrade Codeigniter 1.7.1 to 3.6
Indeed, as cartalot said, you don't need to upgrade through each version, one by one. Just read all the instructions to upgrade between your version and the target one, and build a list of things to do, then you can execute that list on one go. Here are some of the things that I added to my list when upgrading from 1.7.2 to 3.1.3.
Add
return parent::__get($prop);
to your _get magic methods (if you have them).Replace
$this->validation->error_string
withvalidation_errors()
Replace in views
$this->validation->field_name
withset_value(‘field_name’)
andset_select()
, etc.. And add the value to be used to pre-populate each field. But take in account thatset_value()
does not work if you don’t runform_validation->run()
first.When retrieving data: Replace
$this->validation->field_name
and$this->form_validation->field_name
with$this->input->post(‘field_name’)
When setting data: Replace
$this->form_validation->field_name
with$this->form_validation->set_data($data);
Take in account that
set_data($other_data)
overwrites the content of$_POST
, so you need to merge$other_data
and$_POST
.
Good luck, and just power through it!.