Codeigniter 3 HMVC был взломан

Использование этого плагина HMVC в Codeigniter. (https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/src/codeigniter-3.x/)

На другом сервере работает нормально, но на этом сервере я получаю эту ошибку!

A PHP Error was encountered

Severity: 8192

Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior

Filename: MX/Router.php

Line Number: 239

Backtrace:

File: /var/www/project.test/public/application/third_party/MX/Router.php
Line: 239
Function: strpos

File: /var/www/project.test/public/application/third_party/MX/Router.php
Line: 101
Function: _set_default_controller

File: /var/www/project.test/public/index.php
Line: 324
Function: require_once

person Amin    schedule 31.05.2019    source источник


Ответы (3)


На этом сервере работает PHP 7, взгляните на этот запрос на включение:

https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/pull-requests/39/php73-fix-for-error-message-strpos-non/diff

person qwertzman    schedule 31.05.2019

Я меняю строку кода в функции set_class следующим образом:

    {
        //this is the original codes I commented
    /* $suffix = $this->config->item('controller_suffix');
        if (strpos($class, $suffix) === FALSE)
        {
            $class .= $suffix;
        }
        parent::set_class($class); 
    */

      //and change with this one
        $suffix = (string) $this->config->item('controller_suffix');
        if ($suffix && strpos($class, $suffix) === FALSE) {
            $class .= $suffix;
        }

        parent::set_class($class);
    }

Source: https://forum.codeigniter.com/thread-72393.html
person Arnes He    schedule 25.07.2019

Просто обновите функцию в Router.php Путь к файлу: application\ Third_Party\MX\Router.php

public function set_class($class)
    {
    //  $suffix = $this->config->item('controller_suffix');
    //  if (strpos($class, $suffix) === FALSE)

    $suffix = (string) $this->config->item('controller_suffix');
    if ($suffix && strpos($class, $suffix) === FALSE)
    {
        $class .= $suffix;
    }
    parent::set_class($class);
}

После этого работает нормально!

person Chandan Sharma    schedule 01.11.2019