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?

2
  • post the code from core/MY_Router.php, the set_directory method Commented Nov 20, 2019 at 11:50
  • @BinarWeb, I just updated my question with the code Commented Nov 20, 2019 at 12:47

1 Answer 1

2

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) . '/';
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.