Khắc phục lỗi “PHP Fatal error: Uncaught TypeError: Argument 1 passed to CI_Exceptions::show_exception() must be an instance of Exception, instance of ParseError given” trong Codeigniter (ci)

1. Tình trạng lỗi

Tôi sử dụng Codeigniter và xuất hiện lỗi sau.

PHP Fatal error: Uncaught TypeError: Argument 1 passed to CI_Exceptions::show_exception() must be an instance of Exception, instance of ParseError given

2. Nguyên nhân

Do hệ thống update từ php 5 lên php 7 php không còn hiểu kiểu dữ liệu Exception nữa.

3. Cách giải quyết

Bạn tìm đến file system/core/Exceptions.php sau đó thực hiện thay đổi bỏ phần khai báo kiểu dữ liệu đối số của hàm show_exceptionException đi là được.

//public function show_exception(Exception $exception) //Code cũ
public function show_exception($exception)//Code mới đã bỏ đi "Exception"

Hy vọng hữu ích với các bạn!

Nosomovo

Chia sẻ lên
WEB5k - Thiết kế website giá rẻ chuẩn SEO

Hãy bình luận đầu tiên

Để lại một phản hồi