Cara mengatasi Error pada HMVC CodeIgniter di PHP 7.4
Sobat pernah mengalami error seperti di bawah ini :
Message: strpos(): Non-string needles will be interpreted as strings in the future. Use an
explicit chr() call to preserve the current behavior
Ini saya alami saat mencoba menjalankan kembali aplikasi berbasis web yang sebelumnya
saya buat dengan PHP 5.6 di tahun 2018.
Untuk mengatasi masalah tersebut, sobat cukup mengganti Router.php yang berada pada
folder MX, lebih tepatnya lokasinya ini => /third_party/MX/Router.php.
Setelah terbuka, silakan cari fungsi set_class. Gantilah menjadi seperti di bawah ini :
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); }
Selamat mencoba!