Tìm kiếm trên Nosomovo

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)

php error

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_exception là Exception đ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

Thẻ: , , , , ,
Chia sẻ:

Để lại một bình luận

Zalo Gọi ngay