Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problem after upgrade application to CodeIgniter 3

I just upgraded my CodeIgniter from version 2.2 to 3.1.10. I replace system folder and its contents and rename all controller name to capitalized and everything else needed. Then I got this error:

A PHP Error was encountered
Severity: Warning
Message: Declaration of MY_Router::set_directory($dir) should be compatible with CI_Router::set_directory($dir, $append = false)
Filename: core/MY_Router.php
Line Number: 0

Inside application/core there are some files:

  • MY_Route.php
  • MY_Input.php
  • MY_Controller.php
  • etc

UPDATED: here is a piece of code in MY_Route

function set_directory($dir)
{
    // Allow forward slash, but don't allow periods.
    $this->directory = str_replace('.', '', $dir) . '/';
}

I'm sure that the problem is caused by these files but I have no idea what to do. I read the documentation how to upgrade but no clue about this problem. Anyone can help me please?

like image 719
Abaij Avatar asked Apr 30 '26 22:04

Abaij


1 Answers

Maybe help you. You need add argument:

function set_directory($dir, $append = false) <-- edit
{
    // Allow forward slash, but don't allow periods.
    $this->directory = str_replace('.', '', $dir) . '/';
}
like image 174
Dmitry Avatar answered May 02 '26 13:05

Dmitry